azhovan / interview-kit
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-11-20 00:54:18 UTC
README
This package helps you to speed up your development if you have been given a technical assignment.
Kit features:
- PHPUnit
- Laravel ORM and Migrations (default database is SQLite)
- Laravel Routings
- Laravel Controllers and validators
- Guzzle Http client
- Fractal
- PHP dotenv
Application configuration
This app is using .env
file to define it's configurations. you can find it in the root of the project.
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
Run Application (With Docker)
Make sure you have Docker installed. all configurations (dockerfile, nginx) are located inside of build/
folder.
Also you can find docker-composer.yaml
in root of the project. you may run below commands to up and run your application
docker-compose build && docker-compose up -d
docker exec -it project-php-fpm bash -c "composer install && composer dump-autoload -o"
Run tests (integration & unit)
To run integration tests, first make sure you have run above commands to boot the app first, then run vendor/bin/phpunit tests
.
which runs both unit
and integration
tests.
Dependency Injection
If you want to take advantage of dependency injection, you may define an array of dependencies
as below in bootstrap/providers.php
$providers = [ 'Foo' => Foo::class, 'Bar' => Bar::class ];
by now whenever you need a dependency, you can inject it as a parameter.
Migrations
You may define your database table structures in database/migrations
directory. Just like laravel
if your migration class name is AddUsersTable
the corresponding file name would be add_users_table
.
Run migrations
You may run all your migrations by run composer migrate
command.