In simply three easy steps, For a start a new Laravel application running in a local docket environment, you can use Kool CLI’s kool create command. As an open-source dev tool “Kool” that makes using Docker for local development a very much easier.
You need to install Docker & Kool CLI, Before you begin if you haven’t done it already.
(1) Build a new Laravel application
$ kool create laravel my-project
This command may require a little while to finish while “Composer” downloads Laravel’s vendor dependencies. “kool create” automatically runs the “kool preset Laravel” command after installing Laravel. It helps you set up your Application development environment with the use of an interactive wizard.
After picking your choices, the newest version of Laravel will be installed and available for you in your “my-project” folder, along with your new “kool” environment.
Move into your latest Laravel project:
$ cd my-project
Now, “kool preset” this command automatic generate the following configuration files and added them into your project, which you can change or extend.
(2) Update .env.example
Onward we require to make some tweaks to the default “.env.example” document that ships with Laravel in order to match the services in your “docker-compose.yml” file/document. For example, here we have to change the hosts from localhost to the appropriate service container name, which are obtainable from within Docker.
MySQL 5.7 and 8.0 / MariaDB 10.5
(3) Run kool run setup
Now, first time using the setup script in your kool.yml file, spin up your local environment.
$ kool run setup
Note:- if you are use this command first time, then Docker may require to download all the container images that are being used. So, for this process it’ll taking some time.
You can use your new Laravel app at http://localhost, after kool run setup has finished.
Learn More About kool:
- Learn more further regarding using Kool with Laravel, Read the docs for our Laravel Preset
- To learn more extra regarding the Kool open source project, Go to kool.dev
Being the Top Laravel Development Company in India and USA, Simplior Technologies is building extremely secure, Flexible, Robust & Bug-free Web Apps. We follow coding standard, Our code is reusable, clean and well commented which help you understand very well in the later phase.