This Laravel package provides custom Artisan commands to simplify common tasks, such as creating symbolic links, deleting files, and generating Contracts and Responses with service provider bindings.
-
Install the package via Composer:
composer require eren/laravel-commands
-
(Optional) Publish the package configuration file:
php artisan vendor:publish --provider="Eren\LaravelCommands\Providers\LCServiceProvider"
Create a symbolic link from public/storage to storage/app/public. If the link already exists, it will be skipped. Additionally, it creates an uploads folder if it doesn’t exist.
php artisan storage:link-custom- Creates a symbolic link:
public/storage→storage/app/public. - Creates an
uploadsfolder instorage/appif it doesn’t exist.
Delete all files from a specified directory. If no path is provided, it defaults to storage/app/uploads.
php artisan files:delete-all {path?}- Delete files from the default
uploadsfolder:php artisan files:delete-all
- Delete files from a custom path:
php artisan files:delete-all /path/to/folder
- Deletes all files in the specified directory.
- If no path is provided, it defaults to
storage/app/uploads.
Generate a Contract and Response class, and bind them in a service provider.
php artisan make:contract-response {name} {--provider=HomeController1Provider}- Generate
AuthContractandAuthResponse:php artisan make:contract-response Auth
- Specify a custom service provider:
php artisan make:contract-response Auth --provider=CustomServiceProvider
- Creates a Contract class in
app/Http/Contracts/{Name}Contract.php. - Creates a Response class in
app/Http/Responses/{Name}Response.php. - Binds the Contract and Response in the specified service provider (default:
HomeController1Provider). - If the service provider doesn’t exist, it will be created automatically.
You can customize the behavior of the package by publishing the configuration file:
-
Publish the configuration file:
php artisan vendor:publish --provider="Eren\LaravelCommands\Providers\LCServiceProvider" -
Update the configuration file located at
config/laravel-commands.php.
To run the package’s tests, use the following command:
./vendor/bin/phpunitor
php artisan testContributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Submit a pull request.
This package is open-source software licensed under the MIT license.
If you encounter any issues or have questions, please open an issue on the GitHub repository.