Download the PHP package mad-web/laravel-initializer without Composer
On this page you can find all versions of the php package mad-web/laravel-initializer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mad-web/laravel-initializer
More information about mad-web/laravel-initializer
Files in mad-web/laravel-initializer
Package laravel-initializer
Short Description A convenient way to initialize your application
License MIT
Homepage https://github.com/mad-web/laravel-initializer
Informations about the package laravel-initializer
β οΈ Repository archived, new version maintaining under Qruto organization. New version released π check out qruto/laravel-flora. Find upgrade guide to switch from outdated version.
πΊπ¦ π€ If you can support me, I would be very greatful!
A convenient way to initialize your application.
Introduction
We all know, that every application should contain readme file and Installation section with list of actions that you should to do for preparing an application to work.
Typical instruction:
- install dependencies
- run migrations
- publish assets
- compiling app assets
- make cron job for scheduler
- etc.
Some of actions you should do on every application update (composer update, git pull...) or branch change (git checkout) for preparing an application to work.
Laravel Initializer gives you the ability to declare these processes and run it by simple app:install
and app:update
artisan commands, which run predefined actions chain depending on the current environment.
Also app:update
command could simplify your deploy script in Forge, Envoy.blade.php, laravel-deployer, bash script etc.
With Laravel Initializer you keep both of these processes in the source control.
Put a knowledge of application initialization process into the right place
Installation
Via Composer
then publish initializer classes:
It will create Install
and Update
classes in app
directory
which contains local
and production
methods according to different environments.
This methods should return runner chain with specific actions to install or update processes.
You can override config key which stores current environment value, publish config file and set env_config_key
value.
by default value is set to app.env
for laravel, in most cases you don't need to override this value.
Usage
Usage of app:install
and app:update
command are the same except that app:install
uses Install
class and app:update
uses Update
class.
Install class contents:
Update class contents:
You can add any other method which should have the same name as your environment name, for example staging
, and define different actions.
If you need to run actions with root privileges separately, you can define a method according to the following convention:
Run it by passing "root" option:
To see details of running actions use verbosity mode:
You can inject any service from service container in constructor:
If you want to move config classes from the app
directory to a different place, rebind app.installer
and app.updater
keys of service container in the AppServiceProvider
.
Runner API (available actions to run)
Laravel Nova
If you use Laravel Nova, don't forget to publish Nova assets on each update:
Useful jobs
Laravel initializer provides some useful jobs to make initializing of your application much easier.
Create cron task for scheduling tasks
To enable Laravel Scheduling add dispatch MakeCronTask
job to runner chain to create cron task for your application.
This job will add
to crontab list.
Create laravel-echo-server.json config file
If you use Laravel Echo Server for broadcasting events in your application, add dispatch MakeEchoServerConfig
job to runner chain to create configuration file.
It will create configuration file with default options of laravel-echo-server and prefilled values from your laravel application configuration.
You can override default value by passing array into the job constructor. It would be a good practice to create additional config value for laravel-echo-server in broadcasting.php
config:
And pass these values to MakeEchoServerConfig
job constructor.
Create supervisor config file for queues
This job creates supervisor config file for queue workers.
Add dispatch MakeQueueSupervisorConfig
job to runner chain.
This job creates configuration file with the command php artisan queue:work --sleep=3 --tries=3
in /etc/supervisor/conf.d/
folder by default, with a filename according to this convention your-application-name-queue.conf
.
If you want to override default options, pass it into job constructor. For example if you want to use Laravel Horizon instead of default queue workers.
Create supervisor config file for laravel echo server
On the same way as MakeQueueSupervisorConfig
job, you can use MakeSocketSupervisorConfig
to create supervisor config file for launching laravel echo server.
The difference from MakeQueueSupervisorConfig
is the command node ./node_modules/.bin/laravel-echo-server start
and the config filename is your-application-name-socket.conf
.
Both config files save log files to your-app-path/storage/logs
.
Installation by one command
For running php artisan app:install
command, you should install composer dependencies at first.
It would be nice to have the ability to install an application by one command. We provide nice hack to implement this behavior.
Add app-install
script into scripts
section in composer.json
.
Then you can run just
to initialize your application.
If your application has actions that require root privileges and you use Unix based system, add the following command into your runner chain:
Safe Update
In cases when latest changes has been pulled from source control and some functionality of currently not installed package is used in one of a Service Provider you will get an error. To prevent this issue you should make composer install
at first, to simplify this process you can define app-update
script:
Then you can run:
Upgrading
Please see UPGRADING for details.
Changelog
Please see CHANGELOG for more information what has changed recently.
Testing
Contributing
Please see CONDUCT for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
Thanks Nuno Maduro for laravel-console-task package which gives pretty tasks outputs
- Mad Web
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-initializer with dependencies
illuminate/bus Version ^6.0 || ^7.0 || ^8.0 || ^9.0
illuminate/config Version ^6.0 || ^7.0 || ^8.0 || ^9.0
illuminate/console Version ^6.0 || ^7.0 || ^8.0 || ^9.0
illuminate/container Version ^6.0 || ^7.0 || ^8.0 || ^9.0
illuminate/support Version ^6.0 || ^7.0 || ^8.0 || ^9.0
nunomaduro/laravel-console-task Version ^1.5
symfony/process Version ^4.4.11 || ^5.0.9 || ^6.0.3