Parse and validate AT Protocol Lexicons with DTO generation for Laravel

Initial commit

Miguel Batres 09fe6ecf

+26
.github/workflows/code-style.yml
··· 1 + name: Code Style 2 + 3 + on: 4 + push: 5 + branches: [ main, dev ] 6 + pull_request: 7 + branches: [ main, dev ] 8 + 9 + jobs: 10 + php-cs-fixer: 11 + runs-on: ubuntu-latest 12 + 13 + steps: 14 + - name: Checkout code 15 + uses: actions/checkout@v4 16 + 17 + - name: Setup PHP 18 + uses: shivammathur/setup-php@v2 19 + with: 20 + php-version: 8.3 21 + extensions: gmp, mbstring, json 22 + coverage: none 23 + tools: php-cs-fixer 24 + 25 + - name: Run PHP CS Fixer 26 + run: php-cs-fixer fix --dry-run --diff --verbose
+32
.github/workflows/tests.yml
··· 1 + name: Tests 2 + 3 + on: 4 + push: 5 + branches: [ main, dev ] 6 + pull_request: 7 + branches: [ main, dev ] 8 + 9 + jobs: 10 + test: 11 + runs-on: ubuntu-latest 12 + 13 + name: Tests (PHP 8.2 - Laravel 12) 14 + 15 + steps: 16 + - name: Checkout code 17 + uses: actions/checkout@v4 18 + 19 + - name: Setup PHP 20 + uses: shivammathur/setup-php@v2 21 + with: 22 + php-version: 8.2 23 + extensions: gmp, mbstring, json 24 + coverage: none 25 + 26 + - name: Install dependencies 27 + run: | 28 + composer require "laravel/framework:^12.0" "orchestra/testbench:^10.0" --no-interaction --no-update 29 + composer update --prefer-stable --prefer-dist --no-interaction 30 + 31 + - name: Execute tests 32 + run: vendor/bin/phpunit
+5
.gitignore
··· 1 + .DS_Store 2 + .phpunit.result.cache 3 + .php-cs-fixer.cache 4 + composer.lock 5 + /vendor
+35
.php-cs-fixer.php
··· 1 + <?php 2 + 3 + use PhpCsFixer\Config; 4 + use PhpCsFixer\Finder; 5 + 6 + $finder = Finder::create() 7 + ->in(__DIR__ . '/src') 8 + ->in(__DIR__ . '/tests') 9 + ->name('*.php') 10 + ->notName('*.blade.php') 11 + ->ignoreDotFiles(true) 12 + ->ignoreVCS(true); 13 + 14 + return (new Config()) 15 + ->setRules([ 16 + '@PSR12' => true, 17 + 'array_syntax' => ['syntax' => 'short'], 18 + 'ordered_imports' => ['sort_algorithm' => 'alpha'], 19 + 'no_unused_imports' => true, 20 + 'not_operator_with_successor_space' => true, 21 + 'trailing_comma_in_multiline' => true, 22 + 'phpdoc_scalar' => true, 23 + 'unary_operator_spaces' => true, 24 + 'binary_operator_spaces' => true, 25 + 'blank_line_before_statement' => [ 26 + 'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'], 27 + ], 28 + 'phpdoc_single_line_var_spacing' => true, 29 + 'phpdoc_var_without_name' => true, 30 + 'method_argument_space' => [ 31 + 'on_multiline' => 'ensure_fully_multiline', 32 + 'keep_multiple_spaces_after_comma' => true, 33 + ], 34 + ]) 35 + ->setFinder($finder);
+27
CONTRIBUTING.md
··· 1 + # Contributing 2 + 3 + Contributions are welcome and will be fully credited. 4 + 5 + Contributions are accepted via Pull Requests on [Github](https://github.com/social-dept/schema). 6 + 7 + # Things you could do 8 + If you want to contribute but do not know where to start, this list provides some starting points. 9 + - Add license text 10 + - Remove rewriteRules.php 11 + - Set up TravisCI, StyleCI, ScrutinizerCI 12 + - Write a comprehensive ReadMe 13 + 14 + ## Pull Requests 15 + 16 + - **Add tests!** - Your patch won't be accepted if it doesn't have tests. 17 + 18 + - **Document any change in behaviour** - Make sure the `readme.md` and any other relevant documentation are kept up-to-date. 19 + 20 + - **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option. 21 + 22 + - **One pull request per feature** - If you want to do more than one thing, send multiple pull requests. 23 + 24 + - **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting. 25 + 26 + 27 + **Happy coding**!
+5
LICENSE
··· 1 + # The license 2 + 3 + Copyright (c) Author Name <author@email.com> 4 + 5 + ...Add your license text here...
+57
README.md
··· 1 + # Schema 2 + 3 + [![Latest Version on Packagist][ico-version]][link-packagist] 4 + [![Total Downloads][ico-downloads]][link-downloads] 5 + [![Build Status][ico-travis]][link-travis] 6 + [![StyleCI][ico-styleci]][link-styleci] 7 + 8 + This is where your description should go. Take a look at [contributing.md](CONTRIBUTING.md) to see a to do list. 9 + 10 + ## Installation 11 + 12 + Via Composer 13 + 14 + ```bash 15 + composer require social-dept/schema 16 + ``` 17 + 18 + ## Usage 19 + 20 + ## Change log 21 + 22 + Please see the [changelog](changelog.md) for more information on what has changed recently. 23 + 24 + ## Testing 25 + 26 + ```bash 27 + composer test 28 + ``` 29 + 30 + ## Contributing 31 + 32 + Please see [contributing.md](CONTRIBUTING.md) for details and a todolist. 33 + 34 + ## Security 35 + 36 + If you discover any security related issues, please email author@email.com instead of using the issue tracker. 37 + 38 + ## Credits 39 + 40 + - [Author Name][link-author] 41 + - [All Contributors][link-contributors] 42 + 43 + ## License 44 + 45 + MIT. Please see the [license file](LICENSE) for more information. 46 + 47 + [ico-version]: https://img.shields.io/packagist/v/social-dept/schema.svg?style=flat-square 48 + [ico-downloads]: https://img.shields.io/packagist/dt/social-dept/schema.svg?style=flat-square 49 + [ico-travis]: https://img.shields.io/travis/social-dept/schema/master.svg?style=flat-square 50 + [ico-styleci]: https://styleci.io/repos/12345678/shield 51 + 52 + [link-packagist]: https://packagist.org/packages/social-dept/schema 53 + [link-downloads]: https://packagist.org/packages/social-dept/schema 54 + [link-travis]: https://travis-ci.org/social-dept/schema 55 + [link-styleci]: https://styleci.io/repos/12345678 56 + [link-author]: https://github.com/social-dept 57 + [link-contributors]: ../../contributors
+38
composer.json
··· 1 + { 2 + "name": "socialdept/atp-schema", 3 + "description": ":package_description", 4 + "license": "MIT", 5 + "homepage": "https://github.com/socialdept/atp-schema", 6 + "keywords": ["Laravel", "Schema"], 7 + "require": { 8 + "php": "^8.2", 9 + "illuminate/support": "^11.0|^12.0", 10 + "illuminate/console": "^11.0|^12.0", 11 + "illuminate/database": "^11.0|^12.0" 12 + }, 13 + "require-dev": { 14 + "phpunit/phpunit": "^11.0", 15 + "orchestra/testbench": "^9.0", 16 + "friendsofphp/php-cs-fixer": "^3.89" 17 + }, 18 + "autoload": { 19 + "psr-4": { 20 + "SocialDept\\Schema\\": "src/" 21 + } 22 + }, 23 + "autoload-dev": { 24 + "psr-4": { 25 + "SocialDept\\Schema\\Tests\\": "tests" 26 + } 27 + }, 28 + "extra": { 29 + "laravel": { 30 + "providers": [ 31 + "SocialDept\\Schema\\SchemaServiceProvider" 32 + ], 33 + "aliases": { 34 + "Schema": "SocialDept\\Schema\\Facades\\Schema" 35 + } 36 + } 37 + } 38 + }
+5
config/schema.php
··· 1 + <?php 2 + 3 + return [ 4 + // 5 + ];
+22
phpunit.xml
··· 1 + <?xml version="1.0" encoding="UTF-8"?> 2 + <phpunit bootstrap="vendor/autoload.php" 3 + backupGlobals="false" 4 + backupStaticAttributes="false" 5 + colors="true" 6 + verbose="true" 7 + convertErrorsToExceptions="true" 8 + convertNoticesToExceptions="true" 9 + convertWarningsToExceptions="true" 10 + processIsolation="false" 11 + stopOnFailure="false"> 12 + <testsuites> 13 + <testsuite name="Schema Test Suite"> 14 + <directory suffix=".php">./tests/</directory> 15 + </testsuite> 16 + </testsuites> 17 + <filter> 18 + <whitelist> 19 + <directory>src/</directory> 20 + </whitelist> 21 + </filter> 22 + </phpunit>
+18
src/Facades/Schema.php
··· 1 + <?php 2 + 3 + namespace SocialDept\Schema\Facades; 4 + 5 + use Illuminate\Support\Facades\Facade; 6 + 7 + class Schema extends Facade 8 + { 9 + /** 10 + * Get the registered name of the component. 11 + * 12 + * @return string 13 + */ 14 + protected static function getFacadeAccessor(): string 15 + { 16 + return 'schema'; 17 + } 18 + }
+8
src/Schema.php
··· 1 + <?php 2 + 3 + namespace SocialDept\Schema; 4 + 5 + class Schema 6 + { 7 + // Build wonderful things 8 + }
+82
src/SchemaServiceProvider.php
··· 1 + <?php 2 + 3 + namespace SocialDept\Schema; 4 + 5 + use Illuminate\Support\ServiceProvider; 6 + 7 + class SchemaServiceProvider extends ServiceProvider 8 + { 9 + /** 10 + * Perform post-registration booting of services. 11 + * 12 + * @return void 13 + */ 14 + public function boot(): void 15 + { 16 + // $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'social-dept'); 17 + // $this->loadViewsFrom(__DIR__.'/../resources/views', 'social-dept'); 18 + // $this->loadMigrationsFrom(__DIR__.'/../database/migrations'); 19 + // $this->loadRoutesFrom(__DIR__.'/routes.php'); 20 + 21 + // Publishing is only necessary when using the CLI. 22 + if ($this->app->runningInConsole()) { 23 + $this->bootForConsole(); 24 + } 25 + } 26 + 27 + /** 28 + * Register any package services. 29 + * 30 + * @return void 31 + */ 32 + public function register(): void 33 + { 34 + $this->mergeConfigFrom(__DIR__.'/../config/schema.php', 'schema'); 35 + 36 + // Register the service the package provides. 37 + $this->app->singleton('schema', function ($app) { 38 + return new Schema(); 39 + }); 40 + } 41 + 42 + /** 43 + * Get the services provided by the provider. 44 + * 45 + * @return array 46 + */ 47 + public function provides() 48 + { 49 + return ['schema']; 50 + } 51 + 52 + /** 53 + * Console-specific booting. 54 + * 55 + * @return void 56 + */ 57 + protected function bootForConsole(): void 58 + { 59 + // Publishing the configuration file. 60 + $this->publishes([ 61 + __DIR__.'/../config/schema.php' => config_path('schema.php'), 62 + ], 'schema.config'); 63 + 64 + // Publishing the views. 65 + /*$this->publishes([ 66 + __DIR__.'/../resources/views' => base_path('resources/views/vendor/social-dept'), 67 + ], 'schema.views');*/ 68 + 69 + // Publishing assets. 70 + /*$this->publishes([ 71 + __DIR__.'/../resources/assets' => public_path('vendor/social-dept'), 72 + ], 'schema.assets');*/ 73 + 74 + // Publishing the translation files. 75 + /*$this->publishes([ 76 + __DIR__.'/../resources/lang' => resource_path('lang/vendor/social-dept'), 77 + ], 'schema.lang');*/ 78 + 79 + // Registering package commands. 80 + // $this->commands([]); 81 + } 82 + }