lezhnev74 / blank
A blank project
Installs: 8
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 1
Open Issues: 0
Type:project
Requires (Dev)
- roave/security-advisories: dev-master
This package is auto-updated.
Last update: 2024-11-27 15:53:12 UTC
README
This project is a frameworkless foundation for a new backend application in PHP. It is designed in 3-layers: Application, Domain and Infrastructure. It includes, probably, a good initial set of features that one might need.
The idea of this project is to be free in choices of packages. No big framework included, only some popular open-source packages, each of them can be replaced or deinstalled. This is my comfortable default setup that I feel good about.
Docker And ./develop
Tool
This project requires Docker installed, it ships with a docker-compose.yml
configured. You can tweak it as you need,
by default it comes with PHP 7.4 image.
./develop
is a proxy tool to pass command inside of the container (via docker-compose
). Look inside, it supports a number of useful commands:
php
composer
test
debug
serve
migrate
Safety Net
This package cmoes with a set of quality assurance tools which enforce high coding practices:
phpcs
phpcbf
phpstan
deptrac
There is git hook shipped with this project .githooks/pre-commit
. It automatically configured during installation (see scripts
part in composer.json
).
It will check your code upon new commits and outputs errors in the file .qa-report.txt
.
Folders
docker
- configure the PHP imagedocs
- OpenAPI references, see Stoplight Studioweb
- web root for the web serversrc
- all code goes here according to layers.Domain
- core logicApplication
- user facing logic, usecasesInfrastructure
- low level details and implementation
tests
- all tests go herestorage
- all data and resources kept here (including logs)
Installation
- create a new project from this repository:
composer create-project --prefer-source lezhnev74/blank ./
- install fresh versions of dependencies:
./develop composer require \ php-di/php-di \ phlak/config vlucas/phpdotenv \ monolog/monolog \ nesbot/carbon \ doctrine/dbal doctrine/migrations \ slim/psr7 slim/slim \ danielstjules/stringy voku/arrayy ramsey/uuid \ webmozart/assert
./develop composer require --dev \ mockery/mockery \ phpstan/phpstan \ phpunit/phpunit \ squizlabs/php_codesniffer
After Installation
Probably there are manual configuration required after all big parts are complete:
- initialize git via
git init
- configure quality check on git commit (via a git hook):
./develop composer run init-git-hook
- run and make sure git hook is executable
./.git/gooks/pre-commit
- configure quality check on git commit (via a git hook):
- check that
.env
file exists - do global replacement of the root namespace from
Blank\
toMyProject\
(not only in php files, but everywhere). - run
./develop php -v
and./develop test
to confirm PHP container is runnable
Database And Migrations
The project ships with doctrine/dbal
and doctrine/migrations
.
So you can tweak db config in src/Infrastructure/config.php
.
Also migrations are configured in two files: cli-config.php
and migrations.php
.