This generator allows users to generate a pass image by using their Karrot name, photo and ID. The pass also features a QR code that encodes an URL pointing to the same image on the server. It is configured to be limited to one group on Karrot. These users can log in, generate a pass as well as view, download and delete their pass. At the end, they can log out. It uses the Karrot API.
PHP 8.3 is used. Composer is used as dependency manager.
- Guzzle as HTTP client
- monolog for logging
- QR Code as QR code image generator
- Slim as web framework
- Twig as template engine
- Behat for behaviour-driven tests
- phan for static analysis
- PHP_CodeSniffer for enforcing code convention
- phpspec for unit tests
- Install the dependencies:
composer install - Add logo for website as
public/assets/images/logo.png. - Add pass background image as
public/assets/images/pass-background.png. - Copy
public/config/config.sample.phptopublic/config/config.phpand adapt its content. - Create the folder for the passes manually; It needs to be the same you have set in the config file (see previous step).
- Update the dependencies:
composer update - Check for direct dependency updates:
composer outdated --direct
- Execute behat:
XDEBUG_MODE=coverage vendor/bin/behat- A code coverage report is generated in the folder
/coverage-behat.
- A code coverage report is generated in the folder
- Add automatically generated snippets:
vendor/bin/behat --dry-run --append-snippets - Execute tests via phpspec with code coverage report generation:
XDEBUG_MODE=coverage vendor/bin/phpspec run- A code coverage report is generated in the folder
/coverage. - Add
-vto see more details. - Add the path to a test file to only execute that class.
- A code coverage report is generated in the folder
- Generate test class via phpspec:
vendor/bin/phpspec desc "App\Config" - Run the built-in server:
php -S localhost:8888 -t public/
- Execute CodeSniffer:
vendor/bin/phpcs - Execute Phan:
vendor/bin/phan
- Copy the following folders and files:
log/*public/*without the folder for passescomposer.jsoncomposer.lock
- Copy
public/config/config.sample.phptopublic/config/config.phpand adapt its content. - Create the folder for the passes manually; It needs to be the same you have set in the config file (see previous step).
- Run:
composer install --no-dev - Make sure the server serves the
publicfolder only. - Configure your server to not pass
favicon.icorequests to this application to not spam theapp.logfile.