macrominds / app
Basic lib to simplify App setup with IoC, .env and configuration
Requires
- php: ^8.0
- pimple/pimple: ^3.5
- vlucas/phpdotenv: ^5.5
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.19
- phpmetrics/phpmetrics: ^2.8
- phpunit/php-code-coverage: ^9.2
- phpunit/phpunit: ^9.6
This package is not auto-updated.
Last update: 2024-11-10 14:07:05 UTC
README
Basic lib to simplify App setup with IoC, .env and configuration
Usage
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);
}
}
Coding Style
Run vendor/bin/php-cs-fixer fix .
to apply coding style fixes.
Testing this Project
Run ./vendor/bin/phpunit
to run the tests.
Automatic testing and docker images
This project provides a .gitlab-ci.yml and thus uses GitLab CI/CD.
To build the images locally:
$ ./ci.bash build-all-local
Run phpunit inside the containers:
$ ./ci.bash test-all-local
Build and publish the images for gitlab CI (also see gitlab docs):
$ ./ci.bash build-all-remotes-and-publish
Reuse testing setup for your projects
Include
to your project's .gitlab-ci.yml.
If necessary, override the used variables.
See .gitlab-ci.yml for an example of local includes and see the GitLab documentation for includes for a deep dive into local and remote include options and how to override variables.
Metrics and Coverage
- metrics:
composer app:phpmetrics
- coverage report:
composer app:coverage
The reports are stored in thereport
directory. Both scripts will output the path to the reports after successful completion.