azhovan / interview-kit
该软件包最新版本(v0.2)没有可用的许可证信息。
v0.2
2022-05-12 06:03 UTC
Requires
- php: >=7.3
- ext-json: *
- guzzlehttp/guzzle: ^6.5
- illuminate/database: ^6.10
- illuminate/events: ^6.10
- illuminate/filesystem: ^6.11
- illuminate/http: 6.11.*
- illuminate/routing: ^6.11
- illuminate/validation: ^6.11
- league/fractal: ^0.18.0
- nesbot/carbon: ^2.28
- vlucas/phpdotenv: ^4.1
Requires (Dev)
- mockery/mockery: ^1.2
- phpunit/phpunit: ^8.3
- squizlabs/php_codesniffer: 3.*
This package is auto-updated.
Last update: 2024-09-20 00:32:20 UTC
README
如果您接到技术任务,这个软件包可以帮助您加快开发速度。
套件功能
- PHPUnit
- Laravel ORM和迁移(默认数据库为SQLite)
- Laravel路由
- Laravel控制器和验证器
- Guzzle Http客户端
- Fractal
- PHP dotenv
应用配置
此应用程序使用.env文件定义其配置。您可以在项目的根目录中找到它。
APP_URI=localhost:8000 # used to run integration tests suite, this should be same for application DB_CONNECTION= #sqlite or mysql DB_HOST=localhost DB_DATABASE= DB_USERNAME= DB_PASSWORD= DB_PORT=3306
运行应用程序 (使用Docker)
请确保您已安装Docker。所有配置(dockerfile、nginx)都位于build/文件夹内。您还可以在项目根目录中找到docker-composer.yaml。您可以使用以下命令启动并运行应用程序
docker-compose build && docker-compose up -ddocker exec -it project-php-fpm bash -c "composer install && composer dump-autoload -o"
运行测试 (集成 & 单元)
要运行集成测试,请首先确保您已运行上述命令启动应用程序,然后运行 vendor/bin/phpunit tests。这将运行unit和integration测试。
依赖注入
如果您想利用依赖注入,您可以在bootstrap/providers.php中定义以下依赖项数组
$providers = [ 'Foo' => Foo::class, 'Bar' => Bar::class ];
到目前为止,每次您需要依赖项时,您都可以将其作为参数注入。
迁移
您可以在database/migrations目录中定义您的数据库表结构。就像laravel一样,如果您的迁移类名为AddUsersTable,相应的文件名将是add_users_table。
运行迁移
您可以通过运行composer migrate命令来运行所有迁移。