Basic lib to simplify App setup with IoC, .env and configuration
Basic lib to simplify App setup with IoC, .env and configuration
Create your own app and add the traits you need. The default basic App
already
provides use HasContainer
.
use Macrominds\App\App;
class MyApp extends App {
use \Macrominds\Config\UsesDotEnv;
use \Macrominds\Config\IsConfigurable;
use \Macrominds\Services\AllowsServiceRegistration;
use \Macrominds\App\HasDefaultProjectPath;
protected function registerServices(string $projectPath)
{
$this->registerDotEnv($projectPath);
$this->registerDefaultConfig();
$this->registerProjectPathProvider($projectPath);
}
}
Run vendor/bin/php-cs-fixer fix .
to apply coding style fixes.
Run ./vendor/bin/phpunit
to run the tests.
This project provides a .gitlab-ci.yml and thus uses GitLab CI/CD.
To build the images locally:
$ docker build -t macrominds/app:php73 --file ci/php_7.3.df ci
$ docker build -t macrominds/app:php74 --file ci/php_7.4.df ci
Run phpunit inside the container:
$ docker run -it --rm -v $(pwd):/var/www/html macrominds/app:php73 vendor/bin/phpunit
$ docker run -it --rm -v $(pwd):/var/www/html macrominds/app:php74 vendor/bin/phpunit
Build and publish the images for gitlab CI (also see gitlab docs):
$ docker login registry.gitlab.com
$ docker build -t registry.gitlab.com/macrominds/app:php73 --file ci/php_7.3.df ci
$ docker push registry.gitlab.com/macrominds/app:php73
$ docker build -t registry.gitlab.com/macrominds/app:php74 --file ci/php_7.4.df ci
$ docker push registry.gitlab.com/macrominds/app:php74
composer app:phpmetrics
composer app:coverage
The reports are stored in the report
directory.
Both scripts will output the path to the reports after successful completion.