Laravel basic project development process

### projects with composer establish
inexplicable libraries 5.1.11 of less

This directory can not be created so take the composer had to create a 5.2 or download a key installation package
1
2
```
composer create-project laravel/laravel myapp --prefer-dist

### environment configuration items

  • Configuration data connection
    open .env configuration file (this must first be configured either plug-in installation will prompt the following error) There is database.php config in the configuration file is typically modified for multi-database connections inside
  • Initialization composer
    in the configuration search composer and then fill in the address composer.phar not go in, then follow the prompts to download or install it (C: ProgramDataComposerSetupbincomposer.phar This is my position for reference purposes only) and then identified the initialization is complete
  • Line Configuration Tool Support the Command
    1 Click Add Select Tool based on Symfony Console determine
    2 an alias and then add the script address is the location where the artisan if the environment is not running php.exe have to select the address that
    you can point to edit the current selection is completed after 3 global use or use under item (Last time I was selected under the current project to establish this new project is also installed again this time I chose a global look at the next project is not open yet again with a refillable Already down to business is global configuration without the secondIt seems I was wrong though as global commands without having to install but also the namespace so that the resulting file is still in the old project can not be generated in a new project so useless)
    4 configuration files can be copied into it but there must be replaced the project name should not complain
    ## Note
    command Line Tool Support configuration artisan in laravel 5.2 years being given specific reasons unknown may be my phpstorm version of the problem that I have not been upgraded or 10.0.1 fact is crippled in cmd command just had so much input in the project so laravel 5.1 to downgrade the trouble encountered much less than 5.1 can be generated online library composer does not know what the problem is lack of vendor so a key can only be used to create a new installation package 5.2 plug-in supports the project and has changed it originally intended to use 5.2 last but not to give up

### to install the plug phpstrom

  • Laravel plugin

    1
    2
    3
    4
    // phpstrom comes with plug-ins in the configuration of the plugins in search Laravel appeared on the meeting (this can prompt most of the code) 
    // Note that although there is a problem you can not reinstall but did not open a new project you have to reactivate it
    / / settings -> other settings -> Laravel plugin -> the enable plugin for the this Project
    // so this plugin to do so
  • Laravel-ide-helper

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    // Setup 
    Composer The require barryvdh / Laravel-IDE-Helper
    // configuration file to config> app.php> service array
    BarryvdhLaravelIdeHelperIdeHelperServiceProvider :: class,
    // generate some static command prompt such documents will be prompted
    php artisan ide-helper : the generate
    // add in composer.json in the update command (restart automatically generated order can not be changed when changing the latest when the loader to ensure prompt)
    "pre-update-cmd": [
    "the Clear-Compiled PHP Artisan",
    " Artisan-IDE Helper PHP: the Generate ",
    " PHP Artisan Optimize "
    ],
  • illuminate / html
    package name change in the laravel 5.2 can not use that address the following changed

    "5.2. *" `` `Location of the package had been replaced by` `` CollectiveHtml```
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    `` ` 
    // Setup
    Composer The require Illuminate / HTML: ^ 5.0
    // configuration program
    IlluminateHtmlHtmlServiceProvider :: class,
    // set the facade alias configuration file is app.php array of aliases set up a feeling both of which are on the line same
    'Form1' => :: IlluminateHtmlFormFacade class,
    'the Html' => :: IlluminateHtmlHtmlFacade class,

    / *
    In the template file From :: not suggesting
    it is because this directly with the composer require installation directly instead of using the written composer.json in with update installation so ide-helper command is not executed
    Workaround: Manually update it, or ide-helper command at a prompt will appear
    there is a method once and for all is to put this command again when the "pre-install-cmd" array of such installation is automatically performed
    * /

  • Laravel Debugbar

    1
    2
    3
    4
    5
    6
    // Setup 
    Composer the require barryvdh / Laravel-DebugBar
    @ configurator
    BarryvdhDebugbarServiceProvider class ::,
    @ facade arranged alias
    'Debugbar' => BarryvdhDebugbarFacade :: class ,
  • Configuration Command Line Tool Support
    official reference document

    1
    2
    3
    # The above has been configured you can directly use Ctrl + Shift + X Command Line Tool call directly input artisan command prompt on the inside and can be easily complemented 
    # There is a problem is if the custom command is not added to the attention in the example, I added their own make: view (already determined you can add tips) but you can manually add your own tips in the open definition configuration page on editor this option is on the right side to open the fourth point there will be a press xml file the format of the command can be used to fill into the back of the
    future may be able to write a program # added automatically

### to establish a database
database environment has been established in the above configuration is complete, now we began to build the required table

  • Modeling

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    // command with direct modeling and database migration 
    artisan make: model Model / Task -m

    // modify the migration file
    # 2016_03_17_085421_create_tasks_table.php
    public up function ()
    {
    Schema :: the Create ( 'Tasks', function (the Table the Blueprint $) {
    $ table-> Increments (' the above mentioned id ');
    $ table-> String (' name '); // Add field name
    $ the table-> timestamps ();
    });
    }

    // perform the migration command
    artisan migrate
  • Write routing

  • Writing templates

Original: Big Box  Laravel basic project development process


Guess you like

Origin www.cnblogs.com/chinatrump/p/11615036.html