The API backend to the UK Controller Plugin, provides the plugin with information such as dependency files, squawk allocations and user authentication.
The API is built on Laravel's Lumen Framework and uses PHPUnit for tests.
Check | Provider | Status |
---|---|---|
Build (Master) | TravisCI | |
Build (Develop) | TravisCI | |
Style | StyleCI |
- PHP 7.1+
- MySQL 5.7
It is recommended that you use the laravel/homestead Vagrant machine when developing the API. For this you will need Vagrant installed More Information.
- Fork the repository to your personal GitHub
- Clone your fork of the repository locally
- Run
composer install
- Copy
.env.example
to.env
and fill in theAPP_URL
and database credentials - Create a new database for the app to use
- Generate an
APP_KEY
for the application to use [instructions])(https://lumen.laravel.com/docs/5.7#configuration) - Run
php artisan migrate
to run database migrations - Setup Laravel Passport by following the installation guide
- Run
php artisan db:seed
to see the database with test data
- Create a user and generate their API settings file using
php artisan user:create
- Create a user an api key that can administer other users by running
php artisan user:create-admin
- Create a new api key for an existing non-admin user by running
php artisan token:create
- Delete all api keys for a user by running
php artisan tokens:delete-user
Assuming that you have run the migrations and seeded the database, running the tests is as simple as running the following command:
./vendor/bin/phpunit
To check that the code you have written adheres to the PSR-1 and PSR-2 standards, you can use PHP Codesniffer, which is a development dependency of this project. You can run it with the following command:
./vendor/bin/phpcs --file-list=.phpcs --standard=PSR2
You can lint the JSON dependencies that plugins will download by running the following command
php script/lint-dependencies.php