Download the PHP package elie29/core without Composer
On this page you can find all versions of the php package elie29/core. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package core
Core
Introduction
PHP library to create a light straightforward project using PSR-11 container.
Installation
Run the command below to install via Composer:
Getting Started
Core framework does not require a specific structure. Only some configuration should be provided.
Prepare the project structure
In order to configure the framework, we need to have a project structure. Let's assume we have the following standard structure:
- MY_PROJECT
- data:
- cache: Cache folder if cache is activated
- config:
- config.php: Project configuration
- container.php: Container configuration
- public
- index.php: Frontend controller
- src:
- Controllers
- HomeIndexController: Default Core Controller that extends AbstractController
- views
- layouts/layout.html: Layout used by Core Framework when rendering is html
- home/index.phtml: not required unless HomeIndexController uses fetchTemplate
- Controllers
- composer.json
- "php": "^7.1",
- elie29/core
- elie29/zend-phpdi-config: PHP-DI container configurator or choose your own
- data:
Prepare the config file
Regarding the defined structure above, config.php looks as follow:
Prepare the container
container.php
depends on the installed container. For zend-phpdi-config, it looks like:
Create the index.php
Nothing more including autoload.php
and instanciating Core
class as follow:
Create the layout
layout.phtml
is an html file with php variables assigned in the controller or returned by preRun
, run
or postRun
methods.
Example of a layout.phtml
:
Create the first Controller
In the config file, we specified Controllers\\
as a default namespace, but we did not specify a default controller and a default action. In this case, the controller will be home and the action will be index. Therfore, Controller class should be named HomeIndexController with Controllers as namespace.
Each controller should implement Elie\Core\Controller or extends Elie\Core\AbstractController:
Create a template
A template is not required, but in order to have a dynamic layout with several contents, we cas use RenderInterface::fetchTemplate
. phtml templates should be under views_path.
Let's change run
method in order to fetch a template:
detail.phtml
file under src/views/product
folder could be as follow:
Development Prerequisites
Text file encoding
- UTF-8
Code style formatter
- Zend Framework coding standard
Composer commands
clean
: Cleans all generated filestest
: Launches unit testtest-coverage
: Launches unit test with clover.xml file generationcs-check
: For code sniffer checkcs-fix
: For code sniffer fixphpstan
: Launches PHP Static Analysis Toolcheck
: Launchesclean
,cs-check
,test
andphpstan