easy-tool/easy-tool

A simple PHP framework built with composer

dev-main 2022-02-04 19:34 UTC

This package is auto-updated.

Last update: 2024-04-05 00:44:08 UTC


README

This is a simple PHP framework built with Composer.

It uses below libraries:

and follows below standards:

Standard Title Description
PSR-1 Basic Coding Standard Passed PHP_CodeSniffer checking
PSR-3 Logger Interface Implements
- \Psr\Log\AbstractLogger
PSR-4 Autoloader Use Composer as dependency management
PSR-6 Caching Interface Implements
- \Psr\Cache\CacheItemPoolInterface
- \Psr\Cache\CacheItemInterface
PSR-7 HTTP message interfaces Implements
- \Psr\Http\Message\RequestInterface
- \Psr\Http\Message\ResponseInterface
- \Psr\Http\Message\StreamInterface
- \Psr\Http\Message\UriInterface
PSR-11 Container interface Implements
- \Psr\Container\ContainerInterface
PSR-12 Extended Coding Style Passed PHP_CodeSniffer checking
PSR-13 Link definition interfaces pending
PSR-14 Event Dispatcher Implements
- \Psr\EventDispatcher\EventDispatcherInterface
- \Psr\EventDispatcher\ListenerProviderInterface
PSR-15 HTTP Server Request Handlers Implements
- \Psr\Http\Message\ServerRequestInterface
- \Psr\Http\Server\RequestHandlerInterface
PSR-17 HTTP Factories Implements
- \Psr\Http\Message\RequestFactoryInterface
- \Psr\Http\Message\ResponseFactoryInterface
- \Psr\Http\Message\StreamFactoryInterface
- \Psr\Http\Message\UriFactoryInterface
PSR-18 HTTP Client Implements
- \Psr\Http\Client\ClientInterface

Environment Requirement

  • PHP 7.4+
  • MySQL 5.7+

Installation

Create a new folder as project root, execute below command to get source files.

composer create-project easy-tool/easy-tool .

File Structure

Application Structure

Directory Description
app/config Contains application config files, see here for more details.
app/modules Store local customized modules. For example, a customer module may be located at app/modules/Customer, with namespace prefix App\Customer\.
bin There is a run file which is used to execute console command.
pub Store files which can be accessed through internet.
var Store temporary files like cache, log etc.
vendor Composer library folder.

Module Structure

File structure of each module is flexible, but some directries are still need to follow their rules:

Directory Description
Command System retrieves instantiable classes, which extend Symfony\Component\Console\Command\Command, as console commands.
Controller/Backend System retrieves backend controller classes from this folder.
Controller/Frontend System retrieves frontend controller classes from this folder.
Setup System retrieves instantiable classes, which extend EasyTool\Framework\App\Module\Setup\AbstractSetup, as setup scripts on runnig setup:upgrade command.
config Module config files, see here for more details.

Config Files

Application Config

Filename Description
di.php Dependency injection configuration, click here to see file structure, check https://docs.laminas.dev/laminas-di/v3/config/ for more details.
env.php Environment settings including route name, cache setting, database setting etc., click here to see file structure.
events.php Event listener settings, click here to see file structure.
middlewares.php Middleware class list for handling HTTP request, click here to see file structure.
modules.php Module status. This file will be generated by system when cache is empty or disabled.

Module Config

Filename Description
api.php HTTP API route list.
di.php Dependency injection configuration, check https://docs.laminas.dev/laminas-di/v3/config/ for more details.
events.php Event listener settings, file structure is same with the application one.
module.php Module informations including name and route (backend/frontend).