Table des matières
1、安装composer
2、创建你的laravel项目
3、安装Laravel-Administrator包 
4、配置包加载
5、生成Laravel-Administrator配置
6、配置Laravel-Administrator例子
7、配置你的网站
8、开始浏览你的网站
Maison php教程 php手册 laravel administrator 一款通用的后台插件(PHP框架扩展)

laravel administrator 一款通用的后台插件(PHP框架扩展)

Jun 06, 2016 pm 07:47 PM
administrator laravel 后台 pratique

前几天我看了一下zend framework 2的一些官方文档,也找了一些例子,可惜所有的资料少之甚少。于是我就开始去找这国外用的比较流行的PHP框架laravel,希望能够找到其合适的例子,而且我本就打算写一套后台管理系统,却正好发现了其扩展的包。Laravel-Adminis

前几天我看了一下zend framework 2的一些官方文档,也找了一些例子,可惜所有的资料少之甚少。于是我就开始去找这国外用的比较流行的PHP框架laravel,希望能够找到其合适的例子,而且我本就打算写一套后台管理系统,却正好发现了其扩展的包。Laravel-Administrator后台扩展包,提供了基本上通用的界面以及数据操作的例子,我们再也不需要自己去找模板了,特别在这个html5开始盛行的时候,一步步苦苦摸索实在太费时费力。做过后台的朋友不妨看看,这可以使你的工作更快快速和方便。

1、安装composer

  自从vim有统一的插件管理工具pathogen后,估摸着PHP的爱好者才想出了这么一个主意,统一的(依赖)管理器,开源插件进行统一管理也的确势在必行,不说废话了,首先看看怎么安装这个东西吧。

curl -s http:<span>//</span><span>getcomposer.org/installer| php && mv composer.phar /usr/sbin/composer</span>
Copier après la connexion

2、创建你的laravel项目

  一条命令就帮你搭建好了基本的架构,是不是很方便呢?

composer create-project laravel/laravel your-project-name <span>#</span><span>记得改成你的项目名称</span>
Copier après la connexion

3、安装Laravel-Administrator包 

cd your-project-name && vim composer.json <span>#</span><span>进入项目目录并编辑composer.json,把"frozennode/administrator": "dev-master"加入到"require"下</span>
Copier après la connexion

  以下为最终的配置:

<span>{
    </span>"name": "laravel/laravel"<span>,
    </span>"description": "The Laravel Framework."<span>,
    </span>"keywords": ["framework", "laravel"<span>],
    </span>"license": "MIT"<span>,
    </span>"require"<span>: {
        </span>"laravel/framework": "4.2.*"<span>,
        </span>"frozennode/administrator": "dev-master"<span>
    },
    </span>"autoload"<span>: {
        </span>"classmap"<span>: [
            </span>"app/commands"<span>,
            </span>"app/controllers"<span>,
            </span>"app/models"<span>,
            </span>"app/database/migrations"<span>,
            </span>"app/database/seeds"<span>,
            </span>"app/tests/TestCase.php"<span>
        ]
    },
    </span>"scripts"<span>: {
        </span>"post-install-cmd"<span>: [
            </span>"php artisan clear-compiled"<span>,
            </span>"php artisan optimize"<span>
        ],
        </span>"post-update-cmd"<span>: [
            </span>"php artisan clear-compiled"<span>,
            </span>"php artisan optimize"<span>
        ],
        </span>"post-create-project-cmd"<span>: [
            </span>"php artisan key:generate"<span>
        ]
    },
    </span>"config"<span>: {
        </span>"preferred-install": "dist"<span>
    },
    </span>"minimum-stability": "stable"<span>
}</span>
Copier après la connexion

4、配置包加载

vim app/config/app.php <span>#</span><span>找到数组providers,并在最后加入'Frozennode\Administrator\AdministratorServiceProvider',</span>
Copier après la connexion

  以下为最终的配置:

<span>php

</span><span>return</span> <span>array</span><span>(

    </span><span>/*</span><span>
    |--------------------------------------------------------------------------
    | Application Debug Mode
    |--------------------------------------------------------------------------
    |
    | When your application is in debug mode, detailed error messages with
    | stack traces will be shown on every error that occurs within your
    | application. If disabled, a simple generic error page is shown.
    |
    </span><span>*/</span>

    'debug' => <span>true</span>,

    <span>/*</span><span>
    |--------------------------------------------------------------------------
    | Application URL
    |--------------------------------------------------------------------------
    |
    | This URL is used by the console to properly generate URLs when using
    | the Artisan command line tool. You should set this to the root of
    | your application so that it is used when running Artisan tasks.
    |
    </span><span>*/</span>

    'url' => 'http://pfadmins.local.com',

    <span>/*</span><span>
    |--------------------------------------------------------------------------
    | Application Timezone
    |--------------------------------------------------------------------------
    |
    | Here you may specify the default timezone for your application, which
    | will be used by the PHP date and date-time functions. We have gone
    | ahead and set this to a sensible default for you out of the box.
    |
    </span><span>*/</span>

    'timezone' => 'UTC',

    <span>/*</span><span>
    |--------------------------------------------------------------------------
    | Application Locale Configuration
    |--------------------------------------------------------------------------
    |
    | The application locale determines the default locale that will be used
    | by the translation service provider. You are free to set this value
    | to any of the locales which will be supported by the application.
    |
    </span><span>*/</span>

    'locale' => 'en',

    <span>/*</span><span>
    |--------------------------------------------------------------------------
    | Application Fallback Locale
    |--------------------------------------------------------------------------
    |
    | The fallback locale determines the locale to use when the current one
    | is not available. You may change the value to correspond to any of
    | the language folders that are provided through your application.
    |
    </span><span>*/</span>

    'fallback_locale' => 'en',

    <span>/*</span><span>
    |--------------------------------------------------------------------------
    | Encryption Key
    |--------------------------------------------------------------------------
    |
    | This key is used by the Illuminate encrypter service and should be set
    | to a random, 32 character string, otherwise these encrypted strings
    | will not be safe. Please do this before deploying an application!
    |
    </span><span>*/</span>

    'key' => '4g1RkrnrYg1UdkEHxUV3p8UBAlnTmWiZ',

    'cipher' => MCRYPT_RIJNDAEL_128,

    <span>/*</span><span>
    |--------------------------------------------------------------------------
    | Autoloaded Service Providers
    |--------------------------------------------------------------------------
    |
    | The service providers listed here will be automatically loaded on the
    | request to your application. Feel free to add your own services to
    | this array to grant expanded functionality to your applications.
    |
    </span><span>*/</span>

    'providers' => <span>array</span><span>(

        </span>'Illuminate\Foundation\Providers\ArtisanServiceProvider',
        'Illuminate\Auth\AuthServiceProvider',
        'Illuminate\Cache\CacheServiceProvider',
        'Illuminate\Session\CommandsServiceProvider',
        'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider',
        'Illuminate\Routing\ControllerServiceProvider',
        'Illuminate\Cookie\CookieServiceProvider',
        'Illuminate\Database\DatabaseServiceProvider',
        'Illuminate\Encryption\EncryptionServiceProvider',
        'Illuminate\Filesystem\FilesystemServiceProvider',
        'Illuminate\Hashing\HashServiceProvider',
        'Illuminate\Html\HtmlServiceProvider',
        'Illuminate\Log\LogServiceProvider',
        'Illuminate\Mail\MailServiceProvider',
        'Illuminate\Database\MigrationServiceProvider',
        'Illuminate\Pagination\PaginationServiceProvider',
        'Illuminate\Queue\QueueServiceProvider',
        'Illuminate\Redis\RedisServiceProvider',
        'Illuminate\Remote\RemoteServiceProvider',
        'Illuminate\Auth\Reminders\ReminderServiceProvider',
        'Illuminate\Database\SeedServiceProvider',
        'Illuminate\Session\SessionServiceProvider',
        'Illuminate\Translation\TranslationServiceProvider',
        'Illuminate\Validation\ValidationServiceProvider',
        'Illuminate\View\ViewServiceProvider',
        'Illuminate\Workbench\WorkbenchServiceProvider',
        'Frozennode\Administrator\AdministratorServiceProvider',<span>

    )</span>,

    <span>/*</span><span>
    |--------------------------------------------------------------------------
    | Service Provider Manifest
    |--------------------------------------------------------------------------
    |
    | The service provider manifest is used by Laravel to lazy load service
    | providers which are not needed for each request, as well to keep a
    | list of all of the services. Here, you may set its storage spot.
    |
    </span><span>*/</span>

    'manifest' => storage_path().'/meta',

    <span>/*</span><span>
    |--------------------------------------------------------------------------
    | Class Aliases
    |--------------------------------------------------------------------------
    |
    | This array of class aliases will be registered when this application
    | is started. However, feel free to register as many as you wish as
    | the aliases are "lazy" loaded so they don't hinder performance.
    |
    </span><span>*/</span>

    'aliases' => <span>array</span><span>(

        </span>'App'             => 'Illuminate\Support\Facades\App',
        'Artisan'         => 'Illuminate\Support\Facades\Artisan',
        'Auth'            => 'Illuminate\Support\Facades\Auth',
        'Blade'           => 'Illuminate\Support\Facades\Blade',
        'Cache'           => 'Illuminate\Support\Facades\Cache',
        'ClassLoader'     => 'Illuminate\Support\ClassLoader',
        'Config'          => 'Illuminate\Support\Facades\Config',
        'Controller'      => 'Illuminate\Routing\Controller',
        'Cookie'          => 'Illuminate\Support\Facades\Cookie',
        'Crypt'           => 'Illuminate\Support\Facades\Crypt',
        'DB'              => 'Illuminate\Support\Facades\DB',
        'Eloquent'        => 'Illuminate\Database\Eloquent\Model',
        'Event'           => 'Illuminate\Support\Facades\Event',
        'File'            => 'Illuminate\Support\Facades\File',
        'Form'            => 'Illuminate\Support\Facades\Form',
        'Hash'            => 'Illuminate\Support\Facades\Hash',
        'HTML'            => 'Illuminate\Support\Facades\HTML',
        'Input'           => 'Illuminate\Support\Facades\Input',
        'Lang'            => 'Illuminate\Support\Facades\Lang',
        'Log'             => 'Illuminate\Support\Facades\Log',
        'Mail'            => 'Illuminate\Support\Facades\Mail',
        'Paginator'       => 'Illuminate\Support\Facades\Paginator',
        'Password'        => 'Illuminate\Support\Facades\Password',
        'Queue'           => 'Illuminate\Support\Facades\Queue',
        'Redirect'        => 'Illuminate\Support\Facades\Redirect',
        'Redis'           => 'Illuminate\Support\Facades\Redis',
        'Request'         => 'Illuminate\Support\Facades\Request',
        'Response'        => 'Illuminate\Support\Facades\Response',
        'Route'           => 'Illuminate\Support\Facades\Route',
        'Schema'          => 'Illuminate\Support\Facades\Schema',
        'Seeder'          => 'Illuminate\Database\Seeder',
        'Session'         => 'Illuminate\Support\Facades\Session',
        'SoftDeletingTrait' => 'Illuminate\Database\Eloquent\SoftDeletingTrait',
        'SSH'             => 'Illuminate\Support\Facades\SSH',
        'Str'             => 'Illuminate\Support\Str',
        'URL'             => 'Illuminate\Support\Facades\URL',
        'Validator'       => 'Illuminate\Support\Facades\Validator',
        'View'            => 'Illuminate\Support\Facades\View',<span>

    )</span>,<span>

);</span>
Copier après la connexion

5、生成Laravel-Administrator配置

  php artisan config:publish frozennode/administrator <span>#</span><span>生成配置</span>
  vim app/config/packages/frozennode/administrator/administrator.php <span>#</span><span>你可以编辑此文件配置后台参数</span>
Copier après la connexion

6、配置Laravel-Administrator例子

  如果没有示例我们也不知道如何开始,那么就让我们看看这个插件包所给出的例子吧。

  cd ../ <span>#</span><span>退到工作目录</span>
  git clone https://github.com/FrozenNode/Laravel-Administrator <span>#</span><span>下载插件</span>
  cp Laravel-Administrator/examples/app/config/packages/frozennode/administrator/administrator.php your-project-name/app/config/packages/frozennode/administrator/<span>
  cp Laravel</span>-Administrator/examples/app/config/administrator your-project-name/app/config/ -<span>r
  cp Laravel</span>-Administrator/examples/app/models your-project-name/app/ -<span>r
  cp Laravel</span>-Administrator/examples/app/database/migrations/* your-project-name/app/database/migrations/<span>
  mkdir </span>-p your-project-name/public/packages/frozennode/<span>administrator
  cp Laravel</span>-Administrator/public/* your-project-name/public/packages/frozennode/administrator/ -<span>r<br></span>
Copier après la connexion

  <span>#</span><span>创建数据库</span>
  <span>#</span><span>首先根据你数据库的配置创建出你需要的数据,这里以mysql为例</span>
  cd your-project-name <span>#</span><span> 进入你的项目目录</span>
  vim app/config/database.php
Copier après la connexion

  以下为我的配置:

<span>php

</span><span>return</span> <span>array</span><span>(

    </span><span>/*</span><span>
    |--------------------------------------------------------------------------
    | PDO Fetch Style
    |--------------------------------------------------------------------------
    |
    | By default, database results will be returned as instances of the PHP
    | stdClass object; however, you may desire to retrieve records in an
    | array format for simplicity. Here you can tweak the fetch style.
    |
    </span><span>*/</span>

    'fetch' => PDO::FETCH_CLASS,

    <span>/*</span><span>
    |--------------------------------------------------------------------------
    | Default Database Connection Name
    |--------------------------------------------------------------------------
    |
    | Here you may specify which of the database connections below you wish
    | to use as your default connection for all database work. Of course
    | you may use many connections at once using the Database library.
    |
    </span><span>*/</span>

    'default' => 'mysql',

    <span>/*</span><span>
    |--------------------------------------------------------------------------
    | Database Connections
    |--------------------------------------------------------------------------
    |
    | Here are each of the database connections setup for your application.
    | Of course, examples of configuring each database platform that is
    | supported by Laravel is shown below to make development simple.
    |
    |
    | All database work in Laravel is done through the PHP PDO facilities
    | so make sure you have the driver for your particular database of
    | choice installed on your machine before you begin development.
    |
    </span><span>*/</span>

    'connections' => <span>array</span><span>(

        </span>'sqlite' => <span>array</span><span>(
            </span>'driver'   => 'sqlite',
            'database' => __DIR__.'/../database/production.sqlite',
            'prefix'   => '',<span>
        )</span>,

        'mysql' => <span>array</span><span>(
            </span>'driver'    => 'mysql',
            'host'      => 'localhost',
            'database'  => 'pf_admindb',
            'username'  => 'root',
            'password'  => 'mysql',
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',<span>
        )</span>,

        'pgsql' => <span>array</span><span>(
            </span>'driver'   => 'pgsql',
            'host'     => 'localhost',
            'database' => 'forge',
            'username' => 'forge',
            'password' => '',
            'charset'  => 'utf8',
            'prefix'   => '',
            'schema'   => 'public',<span>
        )</span>,

        'sqlsrv' => <span>array</span><span>(
            </span>'driver'   => 'sqlsrv',
            'host'     => 'localhost',
            'database' => 'database',
            'username' => 'root',
            'password' => '',
            'prefix'   => '',<span>
        )</span>,<span>

    )</span>,

    <span>/*</span><span>
    |--------------------------------------------------------------------------
    | Migration Repository Table
    |--------------------------------------------------------------------------
    |
    | This table keeps track of all the migrations that have already run for
    | your application. Using this information, we can determine which of
    | the migrations on disk haven't actually been run in the database.
    |
    </span><span>*/</span>

    'migrations' => 'migrations',

    <span>/*</span><span>
    |--------------------------------------------------------------------------
    | Redis Databases
    |--------------------------------------------------------------------------
    |
    | Redis is an open source, fast, and advanced key-value store that also
    | provides a richer set of commands than a typical key-value systems
    | such as APC or Memcached. Laravel makes it easy to dig right in.
    |
    </span><span>*/</span>

    'redis' => <span>array</span><span>(

        </span>'cluster' => <span>false</span>,

        'default' => <span>array</span><span>(
            </span>'host'     => '127.0.0.1',
            'port'     => 6379,
            'database' => 0,<span>
        )</span>,<span>

    )</span>,<span>

);</span>
Copier après la connexion

  保证数据库用户、密码、IP、端口正确的情况下,还需保证你的数据库存在后再执行以下命令。

  php artisan migrate:install && php artisan migrate <span>#</span><span> 创建数据库及表</span>
  <span>#</span><span>以下是创建生成数据库表的一些命令,了解即可</span>
  <span>#</span><span>php artisan migrate:make create_directors_table</span>
  <span>#</span><span>php artisan migrate:make create_films_table</span>
  <span>#</span><span>php artisan migrate:make create_box_office</span>
  <span>#</span><span>php artisan migrate:make create_actors</span>
  <span>#</span><span>php artisan migrate:make create_actors_films</span>
  <span>#</span><span>php artisan migrate:make create_theaters</span>
  <span>#</span><span>php artisan migrate:make create_films_theaters</span>
Copier après la connexion

7、配置你的网站

  上次说到配置zend framework 2的时候,特别讲到这个配置,而laravel配置是一模一样的。

<span>  server {
    listen </span>80<span>;
    server_name zf2.local.com; </span><span>#</span><span>域名</span>
    root /data/www/zf2/public; <span>#</span><span>你的网站目录,即项目目录记得加上public,否则访问方法不同</span>
<span>    index index.php;
    </span><span>#</span><span>charset utf-8;</span>
    location ~* \.(js|ico|gif|jpg|png|css|jpeg|swf)$<span> {
      access_log off;
      expires 2d;
    }

    location </span>/<span> {
      </span><span>if</span> (!<span>-f</span> <span>$request_filename</span><span>) {
        rewrite ^(.</span>+)$ /index.php?<span>$1</span>&<span> last;
      }
    }
  
    location ~ \.php</span>$<span> {
      </span><span>#</span><span>root /var/www/html/public;</span>
      fastcgi_pass 127.0.0.1:9000; <span>#</span><span>如果你的php-fpm的监听端口不是这个,请设置</span>
<span>      fastcgi_index index.php;
      fastcgi_param SCRIPT_FILENAME </span><span>$document_root$fastcgi_script_name</span><span>;
      include fastcgi_params;
    }

    </span><span>#</span><span> deny access to .htaccess files, if Apache’s document root</span>
    <span>#</span><span> concurs with nginx’s one</span>
    <span>#
</span>    location ~ /<span>\.ht {
      deny all;
    }
  }</span>
Copier après la connexion

8、开始浏览你的网站

  将服务器IP与你的域名绑定,开始浏览,我这里的地址为http://pfadmins.local.com/admin。一定要加上admin,因为后台的url就在admin,当然你可以配置。

laravel administrator 一款通用的后台插件(PHP框架扩展)

laravel administrator 一款通用的后台插件(PHP框架扩展)

laravel administrator 一款通用的后台插件(PHP框架扩展)

Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn

Outils d'IA chauds

Undresser.AI Undress

Undresser.AI Undress

Application basée sur l'IA pour créer des photos de nu réalistes

AI Clothes Remover

AI Clothes Remover

Outil d'IA en ligne pour supprimer les vêtements des photos.

Undress AI Tool

Undress AI Tool

Images de déshabillage gratuites

Clothoff.io

Clothoff.io

Dissolvant de vêtements AI

AI Hentai Generator

AI Hentai Generator

Générez AI Hentai gratuitement.

Article chaud

R.E.P.O. Crystals d'énergie expliqués et ce qu'ils font (cristal jaune)
2 Il y a quelques semaines By 尊渡假赌尊渡假赌尊渡假赌
Repo: Comment relancer ses coéquipiers
1 Il y a quelques mois By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: Comment obtenir des graines géantes
4 Il y a quelques semaines By 尊渡假赌尊渡假赌尊渡假赌
Combien de temps faut-il pour battre Split Fiction?
3 Il y a quelques semaines By DDD

Outils chauds

Bloc-notes++7.3.1

Bloc-notes++7.3.1

Éditeur de code facile à utiliser et gratuit

SublimeText3 version chinoise

SublimeText3 version chinoise

Version chinoise, très simple à utiliser

Envoyer Studio 13.0.1

Envoyer Studio 13.0.1

Puissant environnement de développement intégré PHP

Dreamweaver CS6

Dreamweaver CS6

Outils de développement Web visuel

SublimeText3 version Mac

SublimeText3 version Mac

Logiciel d'édition de code au niveau de Dieu (SublimeText3)

PHP vs Flutter : le meilleur choix pour le développement mobile PHP vs Flutter : le meilleur choix pour le développement mobile May 06, 2024 pm 10:45 PM

PHP et Flutter sont des technologies populaires pour le développement mobile. Flutter excelle dans les capacités multiplateformes, les performances et l'interface utilisateur, et convient aux applications qui nécessitent des performances élevées, une interface utilisateur multiplateforme et personnalisée. PHP convient aux applications côté serveur avec des performances inférieures et non multiplateformes.

Comment utiliser le mappage objet-relationnel (ORM) en PHP pour simplifier les opérations de base de données ? Comment utiliser le mappage objet-relationnel (ORM) en PHP pour simplifier les opérations de base de données ? May 07, 2024 am 08:39 AM

Les opérations de base de données en PHP sont simplifiées à l'aide d'ORM, qui mappe les objets dans des bases de données relationnelles. EloquentORM dans Laravel vous permet d'interagir avec la base de données en utilisant une syntaxe orientée objet. Vous pouvez utiliser ORM en définissant des classes de modèle, en utilisant des méthodes Eloquent ou en créant un système de blog dans la pratique.

Analyse des avantages et inconvénients des outils de tests unitaires PHP Analyse des avantages et inconvénients des outils de tests unitaires PHP May 06, 2024 pm 10:51 PM

Analyse de l'outil de test unitaire PHP : PHPUnit : convient aux grands projets, fournit des fonctionnalités complètes et est facile à installer, mais peut être verbeux et lent. PHPUnitWrapper : adapté aux petits projets, facile à utiliser, optimisé pour Lumen/Laravel, mais a des fonctionnalités limitées, ne fournit pas d'analyse de couverture de code et dispose d'un support communautaire limité.

Laravel - Commandes artisanales Laravel - Commandes artisanales Aug 27, 2024 am 10:51 AM

Laravel - Artisan Commands - Laravel 5.7 est livré avec une nouvelle façon de traiter et de tester de nouvelles commandes. Il inclut une nouvelle fonctionnalité de test des commandes artisanales et la démonstration est mentionnée ci-dessous ?

Comparaison des dernières versions de Laravel et CodeIgniter Comparaison des dernières versions de Laravel et CodeIgniter Jun 05, 2024 pm 05:29 PM

Les dernières versions de Laravel 9 et CodeIgniter 4 fournissent des fonctionnalités et des améliorations mises à jour. Laravel9 adopte l'architecture MVC et fournit des fonctions telles que la migration de bases de données, l'authentification et le moteur de modèles. CodeIgniter4 utilise l'architecture HMVC pour fournir le routage, l'ORM et la mise en cache. En termes de performances, le modèle de conception basé sur le fournisseur de services de Laravel9 et le framework léger de CodeIgniter4 lui confèrent d'excellentes performances. Dans les applications pratiques, Laravel9 convient aux projets complexes qui nécessitent de la flexibilité et des fonctions puissantes, tandis que CodeIgniter4 convient au développement rapide et aux petites applications.

Comment les capacités de traitement des données de Laravel et de CodeIgniter se comparent-elles ? Comment les capacités de traitement des données de Laravel et de CodeIgniter se comparent-elles ? Jun 01, 2024 pm 01:34 PM

Comparez les capacités de traitement des données de Laravel et CodeIgniter : ORM : Laravel utilise EloquentORM, qui fournit un mappage relationnel classe-objet, tandis que CodeIgniter utilise ActiveRecord pour représenter le modèle de base de données en tant que sous-classe de classes PHP. Générateur de requêtes : Laravel dispose d'une API de requêtes chaînées flexible, tandis que le générateur de requêtes de CodeIgniter est plus simple et basé sur des tableaux. Validation des données : Laravel fournit une classe Validator qui prend en charge les règles de validation personnalisées, tandis que CodeIgniter a moins de fonctions de validation intégrées et nécessite un codage manuel des règles personnalisées. Cas pratique : l'exemple d'enregistrement d'utilisateur montre Lar

Tests unitaires de code PHP et tests d'intégration Tests unitaires de code PHP et tests d'intégration May 07, 2024 am 08:00 AM

Guide des tests unitaires et d'intégration PHP Tests unitaires : concentrez-vous sur une seule unité de code ou de fonction et utilisez PHPUnit pour créer des classes de cas de test à des fins de vérification. Tests d'intégration : faites attention à la façon dont plusieurs unités de code fonctionnent ensemble et utilisez les méthodes setUp() et TearDown() de PHPUnit pour configurer et nettoyer l'environnement de test. Cas pratique : utilisez PHPUnit pour effectuer des tests unitaires et d'intégration dans les applications Laravel, notamment la création de bases de données, le démarrage de serveurs et l'écriture de code de test.

Laravel vs CodeIgniter : quel framework est le meilleur pour les grands projets ? Laravel vs CodeIgniter : quel framework est le meilleur pour les grands projets ? Jun 04, 2024 am 09:09 AM

Lors du choix d'un framework pour de grands projets, Laravel et CodeIgniter ont chacun leurs propres avantages. Laravel est conçu pour les applications d'entreprise, offrant une conception modulaire, une injection de dépendances et un ensemble de fonctionnalités puissantes. CodeIgniter est un framework léger plus adapté aux projets de petite et moyenne taille, mettant l'accent sur la rapidité et la facilité d'utilisation. Pour les grands projets avec des exigences complexes et un grand nombre d'utilisateurs, la puissance et l'évolutivité de Laravel sont plus adaptées. Pour les projets simples ou les situations avec des ressources limitées, les capacités de développement légères et rapides de CodeIgniter sont plus idéales.

See all articles