Prototype for web projects using Zend Expressive as PSR-7 middleware
PHP HTML ApacheConf Shell Groovy
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
build
nbproject
src
.gitattributes
.gitignore
CHANGELOG.md
Jenkinsfile
LICENSE
README.md
build.xml
composer.json
composer.lock
updateTestData.sh

README.md

prototype.web.expressive

Prototype for web projects using Zend Expressive as PSR-7 middleware and codenamephp/platform.di as dependency container and main configuration mechanism. Contains build, composer.json, basic project folder structure etc. The interactive installer eliminates the need to pass anything to the command line or do own configuration.

Usage

  1. Install the prototype with composer:
composer create-project "codenamephp/prototype.web.expressive" projectFolder ["version"] [--no-dev]
  1. Follow the instructions on screen
  2. Check the dependency versions in composer.json and execute a composer update
  3. Open in Netbeans and be productive :)

Non-Interactive Mode

The installer can also be exectued in non interactive mode. You can then provide all the answers the installer needs in a serialized array that must be put into answers.serialized in the root folder before the installer is exectued. This can be used for web clients etc. that get all the answers needed before hand.

composer create-project "codenamephp/prototype.web.expressive" projectFolder ["version"] [--no-dev] -n
php -r "file_put_contents('projectFolder/answers.seralized', serialize(['question key' => 'answer']);"
cd projectFolder
composer run-script post-create-project-cmd

Notice the -n when running the create-project command. This puts the installer in non-interactive mode. If you don't do this, it will expect the answers from the command line and not look for the file.

The following question keys need to be set:

  • vendor: The vendor of the package
  • displayName: The human readable name of the package
  • componentName: The package name
  • namespace: the base namespace of the project

Folder structure

├── build
│   ├── phpcomp.xml
│   ├── phpcs.xml
│   ├── phpdox.xml
│   ├── phpmd.xml
│   └── phpunit.xml
├── build.xml
├── CHANGELOG.md
├── composer.json
├── Jenkinsfile
├── LICENSE
├── README.md
├── src
│   ├── main
│   │   └── php
│   │       └── your
│   │           └── namespace
│   │               └── structure
│   │                   ├── action
│   │                   │   └── HomePageAction.php
│   │                   ├── config
│   │                   │   ├── ContainerBuilder.php
│   │                   │   └── definitions
│   │                   │       ├── *.{global,local}.php
│   │                   ├── data
│   │                   ├── public
│   │                   │   ├── assets
│   │                   │   └── index.php
│   │                   └── templates
│   │                       ├── app
│   │                       │   └── home-page.html.twig
│   │                       ├── error
│   │                       │   ├── 404.html.twig
│   │                       │   └── error.html.twig
│   │                       └── layout
│   │                           └── default.html.twig
│   └── test
│       └── php
│           ├── your
│           │   └── namespace
│           │       └── structure
│           │           └── action
│           │               └── HomePageActionTest.php
│           └── phpunit.xml.dist
└── vendor
  • The build folder contains the configs for Jenkins
  • All source files are located under src/main/php followed by the namespace structure
  • The actions folder contains the invokables that are route targets (comparable to controllers)
  • The config folder contains a ContainerBuilder that adds all definitions below the definitions folder. The include squence is:
    1. Include the global.php file
    2. Include all *.global.php files
    3. Include the local.php file
    4. Include all *.local.php files This way, all global configurations can be overwritten by *.local.php files which are ignored by the vcs so you can set configurations for your local environment