├── CHANGELOG.md ├── LICENSE.md ├── README.md ├── composer.json └── src ├── Console ├── Concerns │ └── InteractsWithConsoleCommands.php └── ModelMakeCommand.php └── LaraCommandServiceProvider.php /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to `Laracommand` will be documented in this file. 4 | 5 | ## v2.0.2 - 2022-02-12 6 | 7 | ## Update 8 | 9 | - update `README.md` 10 | 11 | ## v2.0.1 - 2022-02-10 12 | 13 | ## What's Changed 14 | 15 | - V2 by @ousid in https://github.com/coderflexx/laracommand/pull/2 16 | 17 | **Full Changelog**: https://github.com/coderflexx/laracommand/compare/v1.2.0...v2.0.1 18 | 19 | ## v2.0.0 - 2022-02-10 20 | 21 | ## Add 22 | 23 | Laravel 9 Support 24 | 25 | ## v1.2.0 - 2022-02-10 26 | 27 | ## Add 28 | 29 | - Tests to `ModelMakeCommandTest` 30 | 31 | ## Update 32 | 33 | - `ModelMakeCommand` logic 34 | 35 | ## Update README.md - 2022-02-08 36 | 37 | ## Updates: 38 | 39 | - Fix a misleading link 40 | 41 | **Full Changelog**: https://github.com/coderflexx/laracommand/compare/v1.1.0...v1.1.1 42 | 43 | ## v1.1.0 - 2022-02-05 44 | 45 | - Rename the service provider class from `LaraCommandsServiceProvider.php` to `LaraCommandServiceProvider.php` 46 | 47 | ## v1.0.0 - 2022-02-05 48 | 49 | ## Initial release. 50 | 51 | - Add `laracommand:make-model` console command 52 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) coderflex 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 13 | all 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 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | laracommand Logo 3 |

4 | laracommand Example 5 |

6 | 7 | 8 | [![Latest Version on Packagist](https://img.shields.io/packagist/v/coderflexx/laracommand.svg?style=flat-square)](https://packagist.org/packages/coderflexx/laracommand) 9 | [![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/coderflexx/laracommand/run-tests?label=tests)](https://github.com/coderflexx/Laracommand/actions?query=workflow%3Arun-tests+branch%3Amain) 10 | [![GitHub Code Style Action Status](https://img.shields.io/github/workflow/status/coderflexx/laracommand/Check%20&%20fix%20styling?label=code%20style)](https://github.com/coderflexx/laracommand/actions?query=workflow%3A"Check+%26+fix+styling"+branch%3Amain) 11 | 12 | A Cli tool to save you time, and gives you the power to scaffold all of your models,controllers,commands... at once 13 | 14 | ## Installation 15 | 16 | You can install the package via composer: 17 | 18 | ```bash 19 | composer require coderflexx/laracommand --dev 20 | ``` 21 | 22 | Or, if you are using `v8` you can install `v1.*` 23 | 24 | ```bash 25 | composer require "coderflexx/laracommand ^1" --dev 26 | ``` 27 | 28 | 29 | ## Usage 30 | 31 | Use the commands like using `laravel` make commands 32 | 33 | - make model command 34 | 35 | ```bash 36 | php artisan laracommand:make-model FirstModel SecondModel 37 | ``` 38 | You can generate as many as you want of models, and you can add options like `make:model` command 39 | 40 | Check out the [docs](https://laravel.com/docs/8.x/eloquent#generating-model-classes) for more, just replace `make:model` with `laracommand:make-model` 41 | 42 | 43 | ## Testing 44 | 45 | ```bash 46 | composer test 47 | ``` 48 | 49 | ## Note 50 | This package is for development use only, you are free to disable/remove it once you are done with. 51 | 52 | ## Changelog 53 | 54 | Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. 55 | 56 | ## Contributing 57 | 58 | Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details. 59 | 60 | ## Security Vulnerabilities 61 | 62 | Please review [our security policy](../../security/policy) on how to report security vulnerabilities. 63 | 64 | ## Credits 65 | 66 | - [Oussama Sid](https://github.com/ousid) 67 | - [All Contributors](../../contributors) 68 | 69 | ## License 70 | 71 | The MIT License (MIT). Please see [License File](LICENSE.md) for more information. 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "coderflexx/laracommand", 3 | "description": "Tool to save you time, and scaffold all of your files in one command.", 4 | "keywords": [ 5 | "coderflex", 6 | "laravel", 7 | "Laracommand" 8 | ], 9 | "homepage": "https://github.com/coderflexx/Laracommand", 10 | "license": "MIT", 11 | "authors": [ 12 | { 13 | "name": "oussama", 14 | "email": "oussama@coderflex.com", 15 | "role": "Developer" 16 | } 17 | ], 18 | "require": { 19 | "php": "^8.0", 20 | "spatie/laravel-package-tools": "^1.9.2", 21 | "illuminate/contracts": "^9.0" 22 | }, 23 | "require-dev": { 24 | "nunomaduro/collision": "^6.0", 25 | "nunomaduro/larastan": "^1.0", 26 | "orchestra/testbench": "^7.0", 27 | "pestphp/pest": "^1.21", 28 | "pestphp/pest-plugin-laravel": "^1.2", 29 | "phpstan/extension-installer": "^1.1", 30 | "phpstan/phpstan-deprecation-rules": "^1.0", 31 | "phpstan/phpstan-phpunit": "^1.0", 32 | "phpunit/phpunit": "^9.5.4" 33 | }, 34 | "autoload": { 35 | "psr-4": { 36 | "Coderflex\\LaraCommand\\": "src" 37 | } 38 | }, 39 | "autoload-dev": { 40 | "psr-4": { 41 | "Coderflex\\LaraCommand\\Tests\\": "tests" 42 | } 43 | }, 44 | "scripts": { 45 | "analyse": "vendor/bin/phpstan analyse", 46 | "test": "vendor/bin/pest", 47 | "test-coverage": "vendor/bin/pest --coverage" 48 | }, 49 | "config": { 50 | "sort-packages": true 51 | }, 52 | "extra": { 53 | "laravel": { 54 | "providers": [ 55 | "Coderflex\\LaraCommand\\LaraCommandServiceProvider" 56 | ], 57 | "aliases": { 58 | "LaraCommand": "Coderflex\\LaraCommand\\Facades\\LaraCommand" 59 | } 60 | } 61 | }, 62 | "minimum-stability": "dev", 63 | "prefer-stable": true 64 | } 65 | -------------------------------------------------------------------------------- /src/Console/Concerns/InteractsWithConsoleCommands.php: -------------------------------------------------------------------------------- 1 | argument('name'))); 21 | collect($models)->each(function ($name) use ($command) { 22 | $this->line("Generating {$name} class\n"); 23 | 24 | $this->call( 25 | $command, 26 | array_merge(['name' => $name], $this->getListOfOptions()) 27 | ); 28 | 29 | if ( 30 | count(array_filter($this->getListOfOptions())) 31 | ) { 32 | $this->line(" {$name} assets created successfully.\n"); 33 | $this->line("----------------------------------------------------------------\n"); 34 | } 35 | }); 36 | 37 | $this->line(" DONE 🤙\n"); 38 | 39 | return true; 40 | } 41 | 42 | /** 43 | * Get the list of options 44 | * 45 | * @return array 46 | */ 47 | private function getListOfOptions(): array 48 | { 49 | $options = []; 50 | 51 | collect($this->getOptions())->each(function ($option) use (&$options) { 52 | $key = reset($option); 53 | 54 | $options['--' . $key] = (bool) $this->option($key); 55 | }); 56 | 57 | return $options; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/Console/ModelMakeCommand.php: -------------------------------------------------------------------------------- 1 | loopThroughNameArgumentWith('make:model') 28 | ) { 29 | return self::SUCCESS; 30 | } 31 | 32 | return self::FAILURE; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/LaraCommandServiceProvider.php: -------------------------------------------------------------------------------- 1 | name('Laracommand') 22 | ->hasCommands([ 23 | ModelMakeCommand::class, 24 | ]); 25 | } 26 | } 27 | --------------------------------------------------------------------------------