Sākot jaunu projektu, vienmēr ir jāmeklē kā tas jādara. Jāmeklē paplašinājumi, kurus es parasti lietoju, kā viņus korekti uzstādīt un lietot. Lai katru reizi neatkārtotu šo meklēšanas procesu, es izveidoju šo rakstu un plānoju to paplašināt ar koda piemēriem un jauniem paplašinājumiem, lai visu varētu atrast vienā vietā.

Instalācija

    1. composer create-project laravel/laravel
    2. Ja nepieciešams: composer self-update

 

Composer.json

You have too much code in app/models and app/controllers.

Your application is growing and there’s too many files in the few directories Laravel initially provides.

Use a PSR-4 directory structure.

First edit composer.json and update the autoload section.

{
    "autoload": {
        "psr-4": {
            "MyApp\\": "app/MyApp"</pre>
<pre> },
 "classmap": [
 "app/commands",
 "app/database/migrations"
 "app/database/seeds",
 "app/tests/TestCase.php"
 ]
 }
}

Let’s say you have a controller for the above app to handle miscellaneous pages. You might have a file inapp/MyApp/Controllers named MiscController.php. This file would look something like.
Example class:

<?php namespace MyApp\Controllers;

class MiscController extends \Controller {
    // methods go here
}
?>

 

Paplašinājumi

    1. Laravel IDE Helper Generator
    2. Laravel 4 Debugbar
    3. Faker
    4. Former

 

1. Laravel IDE Helper Generator

    1. Pievienojam composer.json "barryvdh/laravel-ide-helper": "1.*"
    2. composer update
    3. Pievienojam ServiceProvider provaideru masīvam app/config/app.php failā: 'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider',
    4. php artisan clear-compiledphp artisan ide-helper:generate un php artisan optimize
    5. Nokonfigurējam composer.json tā, lai ģenerācija notiktu ik pēc katra komita:

"scripts":{
    "post-update-cmd":[
        "php artisan clear-compiled",
        "php artisan ide-helper:generate",
        "php artisan optimize",
    ]
},

 

2. Laravel 4 Debugbar

Debugbar

    1. Pievienojam composer.json "barryvdh/laravel-debugbar": "1.*"
    2. composer update
    3. Pievienojam ServiceProvider provaideru masīvam app/config/app.php failā: 'Barryvdh\Debugbar\ServiceProvider',
    4. php artisan debugbar:publish
    5. Nokonfigurējam composer.json tā, lai atjauninājumu gadījumā aplikācija atjauno arī šo paplašinājumu
"post-update-cmd": [
    "php artisan debugbar:publish"
],

 

3. Faker

    1. Pievienojam composer.json "fzaninotto/faker": "1.3.*@dev"
    2. composer update
    $faker = Faker\Factory::create();

 

4. Former

    1. Pievienojam composer.json "anahkiasen/former": "dev-master"
    2. composer update
    3. Pievienojam ServiceProvider provaideru masīvam app/config/app.php failā: 'Former\FormerServiceProvider',
    4. Pievienojam facade aliasu masīvam app/config/app.php failā: 'Former' => 'Former\Facades\Former',