Laravel Project Setup
Web Design & IT Services in Swanage, Poole, Bournemouth and Dorset by Matthew Pond
Tags
Install via Composer
You can install Laravel by issuing the Composer create-project command in your terminal:
composer create-project --prefer-dist laravel/laravel blog
Once the project is installed you can view in your brower, you will need to point your local server to the public folder. Or you can also run the following command to start a development server on http://127.0.0.1:8000.
php artisan serve
Once you start editting the assets such as CSS you will need to complete a coupel steps. Within a fresh installation of Laravel, you’ll find a package.json file in the root of your directory structure. The default package.json file includes everything you need to get started. Think of this like your composer.json file, except it defines Node dependencies instead of PHP. You may install the dependencies it references by running:
npm install
If you are developing on a Windows system or you are running your VM on a Windows host system, you may need to run the npm install command with the –no-bin-links switch enabled:
npm install --no-bin-links
Once that is done you can update the assets:
npm run dev
And that will recompile the asset files. Its probably worth at this point turning to something like BrowserSync to manage all the asset updates as we work on the project.
Control and Model Setup
Something…
php artisan make:controller PagesController
Something…
php artisan make:controller PagesController - r
Will create the controller with all the boiler plate code and standard actiosn such as:
index() create() store() show() edit() update() destroy()
This convention keeps it simple and follows standards must developers will also understand.
If you then want to automatically get the model started with the boilerplate model, and the new model will automtcally be included in the controller.
php artisan make:controller PagesController -r -m Page