├── LICENSE ├── composer.json ├── config └── config.php ├── helpers.php └── src ├── Providers └── SkeletonServiceProvider.php └── Skeleton.php /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Algo Younes 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "algoyounes/laravel-package-skeleton", 3 | "description": "Laravel Package Skeleton for streamlined package development", 4 | "keywords": [ 5 | "laravel", 6 | "package", 7 | "skeleton", 8 | "skeleton-package", 9 | "laravel package", 10 | "laravel package skeleton", 11 | "package skeleton", 12 | "package development" 13 | ], 14 | "type": "library", 15 | "license": "MIT", 16 | "authors": [ 17 | { 18 | "name": "Younes ENHARI", 19 | "email": "algoyounes@gmail.com" 20 | } 21 | ], 22 | "autoload": { 23 | "psr-4": { 24 | "AlgoYounes\\Skeleton\\": "src/" 25 | }, 26 | "files": [ 27 | "./helpers.php" 28 | ] 29 | }, 30 | "autoload-dev": { 31 | "psr-4": { 32 | "AlgoYounes\\Skeleton\\Tests\\": "tests" 33 | } 34 | }, 35 | "require": { 36 | "php": "^8.2" 37 | }, 38 | "suggest": { 39 | "illuminate/support": "for the Laravel integration", 40 | "illuminate/contracts": "for the Laravel integration" 41 | }, 42 | "require-dev": { 43 | "laravel/framework": "^11", 44 | "laravel/pint": "^1.13.7", 45 | "orchestra/testbench": "^9.0", 46 | "pestphp/pest": "^2.28.1", 47 | "phpstan/phpstan": "1.10.56", 48 | "rector/rector": "0.19.5" 49 | }, 50 | "scripts": { 51 | "refactor": "rector", 52 | "test:refactor": "rector --dry-run", 53 | "test:types": "phpstan analyse --ansi", 54 | "test:unit": "pest --colors=always", 55 | "test:lint": "pint --test", 56 | "test": [ 57 | "@test:refactor", 58 | "@test:lint", 59 | "@test:types", 60 | "@test:unit" 61 | ], 62 | "fix:lint": "pint --preset laravel", 63 | "fix:refactor": "rector", 64 | "fix": [ 65 | "@fix:refactor", 66 | "@fix:lint" 67 | ], 68 | "hook": [ 69 | "@hook:pre-commit", 70 | "@hook:pre-push" 71 | ], 72 | "hook:install": [ 73 | "ln -sf $PWD/hooks/pre-commit .git/hooks/pre-commit", 74 | "chmod +x .git/hooks/pre-commit", 75 | "ln -sf $PWD/hooks/pre-push .git/hooks/pre-push", 76 | "chmod +x .git/hooks/pre-push" 77 | ], 78 | "hook:pre-commit": [ 79 | "hooks/pre-commit" 80 | ], 81 | "hook:pre-push": [ 82 | "hooks/pre-push" 83 | ], 84 | "post-install-cmd": [ 85 | "@hook:install" 86 | ] 87 | }, 88 | "config": { 89 | "sort-packages": true, 90 | "preferred-install": "dist", 91 | "allow-plugins": { 92 | "pestphp/pest-plugin": true 93 | } 94 | }, 95 | "minimum-stability": "stable", 96 | "prefer-stable": true 97 | } 98 | -------------------------------------------------------------------------------- /config/config.php: -------------------------------------------------------------------------------- 1 | $abstract 8 | * @return TClass 9 | */ 10 | function make(string $abstract, array $parameters = []) 11 | { 12 | return \Illuminate\Container\Container::getInstance()->make($abstract, $parameters); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Providers/SkeletonServiceProvider.php: -------------------------------------------------------------------------------- 1 | publishConfig(); 12 | } 13 | 14 | public function register(): void 15 | { 16 | $this->registerConfig(); 17 | } 18 | 19 | // Boot methods : 20 | private function publishConfig(): void 21 | { 22 | if ($this->app->runningInConsole()) { 23 | $this->publishes([ 24 | dirname(__DIR__, 2).'/config/skeleton.php' => config_path('skeleton.php'), 25 | ], 'config'); 26 | } 27 | } 28 | 29 | // Register methods : 30 | private function registerConfig(): void 31 | { 32 | $this->mergeConfigFrom(dirname(__DIR__, 2).'/config/skeleton.php', 'skeleton'); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Skeleton.php: -------------------------------------------------------------------------------- 1 |