Skip to content
JP Barbosa edited this page Mar 14, 2016 · 5 revisions

Setup

Create new Laravel project using the installer
composer global require "laravel/installer"
laravel new laravel-apz
Enter in the app directory
cd laravel-apz
Change .gitignore to ignore any .env except .env.example
nano .gitignore
.env*
!.env.example
Change default database to sqlite
nano .env
...
DB_CONNECTION=sqlite
...
Create database
touch database/database.sqlite
Add database to .gitignore
echo '/database/*.sqlite' >> .gitignore
Require PHP 5.5.x and HTML/Forms helpers via composer
composer require php:~5.5.0
composer require laravelcollective/html
Add HTML and Forms helpers services providers and facades
nano config/app.php
    'providers' => [
        ...
        Collective\Html\HtmlServiceProvider::class,
    ]
    ...
    'aliases' => [
        ...
        'Form'      => Collective\Html\FormFacade::class,
        'Html'      => Collective\Html\HtmlFacade::class,
    ]
Override tokensMatch to not use token when request wants JSON
nano app/Http/Middleware/VerifyCsrfToken.php
    protected function tokensMatch($request)
    {
        if ($request->wantsJson()) {
            return true;
        }
        return parent::tokensMatch($request);
    }
Start Laravel server
php artisan serve
Open app in the browser
open http://localhost:8000
Create Git Repo, add all files and commit
git init
git add .
git commit -m "Basic Laravel app files"
Next step: Basic CRUD
Clone this wiki locally