zoukankan      html  css  js  c++  java
  • laravel composer 安装指定版本以及基本的配置

    1 安装指定的 laravel版本 以下的案例是安装5.5版本

    composer create-project laravel/laravel=5.5.* --prefer-dist

    2 配置 优化相关参数

       打开 config/app.php文件 优化以下配置参数   

    'timezone' => 'Asia/Shanghai',
    'log' => env('APP_LOG', 'daily'),
    'log_level' => env('APP_LOG_LEVEL', 'debug'),

       打开 config/database.php  优化以下配置参数

    'fetch' => PDO::FETCH_ASSOC,

       打开 config/cache.php 优化以下配置参数

    'prefix' => env('CACHE_PREFIX', 'wap_site'),

       打开 config/session.php  优化以下配置参数

    'cookie' => 'pro_site',

    3  安装 扩展包

      Laravel 5 Repositories  

     composer require prettus/l5-repository 
     
     编辑 config/app.php
       
     在 providers 数组里面写入 以下配置
      
      PrettusRepositoryProvidersRepositoryServiceProvider::class,
     
     
     在cmd 下面执行
       
      php artisan vendor:publish  
     
     在 config文件夹下面生成   repository.php
     
       
     编辑   config/repository.php
     
      更改如下
     
      'generator'  => [
          'basePath'      => app_path(),
          'rootNamespace' => 'App\',
          'paths'         => [
              'models'       => 'Entities',
              'repositories' => 'RepositoriesEloquent',
              'interfaces'   => 'RepositoriesInterfaces',
              'transformers' => 'Transformers',
              'presenters'   => 'Presenters',
              'validators'   => 'Validators',
              'controllers'  => 'Http/Controllers',
              'provider'     => 'RepositoryServiceProvider',
              'criteria'     => 'Criteria',
              'stubsOverridePath' => app_path()
          ]
      ]
     
     在 cmd 下面执行
      
      php artisan make:provider    RepositoryServiceProvider 
      然后会自动生成相对应的服务层文件
     
     编辑 config/app.php  在 providers 数组里面写入
    AppProvidersRepositoryServiceProvider::class,  
     
     最后根据官方的说明文档使用该扩展包

    安装 扩展包

    redis 扩展
    composer require predis/predis 1.0.*    
    laravel-ide-helper 扩展包
    composer require barryvdh/laravel-ide-helper  
    写入 config
    /app.php文件 BarryvdhLaravelIdeHelperIdeHelperServiceProvider::class,
    laravel-debugbar 扩展包
    composer require barryvdh/laravel-debugbar 
    memcache 扩展
    composer require swiggles/memcache
    在config / app.php中添加memcache服务提供者:
    SwigglesMemcacheMemcacheServiceProvider::class,
    您现在可以更新您的config / cache.php配置文件以使用memcache
    'default' => 'memcache',
    您现在可以更新config / session.php配置文件以使用memcache
    'driver' => 'memcache',

    4 优化 laravel 配置

        编辑 composer.json  

        在 post-update-cmd 数组里面写入优化的优化参数

    "php artisan cache:clear",
    "php artisan route:cache",
    "php artisan optimize",
    "php artisan ide-helper:generate",
    "php artisan ide-helper:meta",
    "composer dumpautoload",
    "php artisan clear-compiled"
  • 相关阅读:
    c&c++中的宏
    cmake教程
    什么是Grunt
    npm-install camo
    在node.js中建立你的第一个HTTp服务器
    highChart数据动态更新
    css:before和after中的content属性
    清除float浮动三种方式
    中文标准web字体
    网站桌面端和手机端不同url的设置
  • 原文地址:https://www.cnblogs.com/aini521521/p/7754872.html
Copyright © 2011-2022 走看看