PHP code example of seffeng / laravel-demo

1. Go to this page and download the library: Download seffeng/laravel-demo library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

seffeng / laravel-demo example snippets


php 版本 >= 8.1
shell
# composer 安装
1、laravel10
$ composer create-project seffeng/laravel-demo

2、laravel8
$ composer create-project seffeng/laravel-demo:~8.0

3、laravel6
$ composer create-project seffeng/laravel-demo:~6.0 --prefer-dist

# 源码 安装
1、安装
$ composer install -vvv
$ php ./artisan key:generate
$ php ./artisan jwt:secret

2、创建数据库;

3、修改 .env 对应配置,如关闭DEBUG(APP_DEBUG=false)、数据库信息(DB_DATABASE)等;

4、执行迁移脚本创建数据表,初始数据,初始用户:(账号:10086, 密码:Aa123456);
$ php ./artisan migrate --seed

5、前台根目录为 /public/frontend,后台根目录为 /public/backend, API根目录为 /public/api;

6、增加网站应用;
# 1. /public 目录下增加应用入口,nginx配置root;
# 2. /config/packet.php 增加应用设置;
# 3. /app/Web 目录下增加对应应用;
# 4. /routes 目录下增加对应路由;
# 5. 其他:/storage/framework/views、/resources/views。

7、数据库账号密码加密配置;
# .env 文件配置参数 APP_CRYPT=false,若为 true 则 .env 文件中 数据库账号,数据库密码,redis密码需为加密后的字符;
# 可执行命令 php artisan crypt {原始字符},如:
# 1、数据账号为 root
# 2、执行命令 php artisan crypt root
# 3、将生成的字符填入 .env 配置 DB_USERNAME=生成字符
# 其他需加密的字符配置参考配置文件 config/database.php