quidphp/core

PHP library that provides an extendable platform to create dynamic applications

5.31.0 2022-07-02 23:30 UTC

This package is auto-updated.

Last update: 2023-09-10 23:10:28 UTC


README

Release License PHP Version Style CI Code Size

About

QuidPHP/Core is a PHP library that provides an extendable platform to create dynamic applications. It is part of the QuidPHP package.

License

QuidPHP/Core is available as an open-source software under the MIT license.

Documentation

QuidPHP/Core documentation is available at QuidPHP/Docs.

Installation

QuidPHP/Core can be easily installed with Composer. It is available on Packagist.

$ composer require quidphp/core

Once installed, the Quid\Core namespace will be available within your PHP application.

Requirement

QuidPHP/Core requires the following:

Dependency

QuidPHP/Core has the following dependencies:

  • quidphp/orm - Quid\Orm - PHP library that provides database access and a comprehensive ORM
  • quidphp/routing - Quid\Routing - PHP library that provides a route matching and triggering procedure
  • phpmailer/phpmailer - PHPMailer\PHPMailer - The classic email sending library for PHP
  • scssphp/scssphp - ScssPhp\ScssPhp - SCSS compiler written in PHP
  • tedivm/jshrink - JShrink - Javascript Minifier written in PHP
  • verot/class.upload.php - Verot\Upload - A popular PHP class used for resizing images

All dependencies will be resolved by using the Composer installation process.

Comment

QuidPHP/Core code is commented and all methods are explained (in French).

Convention

QuidPHP/Core is built on the following conventions:

  • Auto-alias: All class names that finishes by Alias will resolve to the existing class if no alias exists. Exemple: MyRole extents RoleAlias -> will resolve to Role if no alias is found.
  • Class overloading: It is possible to retrieve an overloaded class with the same name but higher in the namespace hierarchy. We do this by using the static method $class::getOverloadClass(). Exemple Quid\Orm\Col::getOverloadClass() will return Quid\Core\Col.
  • Coding: No curly braces are used in a IF statement if the condition can be resolved in only one statement.
  • Config: A special $config static property exists in all classes. This property gets recursively merged with the parents' property on initialization.
  • Core overloading: Using auto-alias and class overloading, it is possible to effectively replace all classes within Quid\Core by classes within an application directory.
  • Traits: Traits filenames start with an underscore (_).
  • Type: Files, function arguments and return types are strict typed.

Overview

QuidPHP/Core contains 115 classes and traits. Here is an overview:

  • Boot - Abstract class for boot which is the object that bootstraps the application
  • Cell - Extended class to represent an existing cell within a row
    • Date - Class to work with a cell containing a date value
    • Enum - Class to manage a cell containing a single relation (enum)
    • Files - Abstract class extended by the media and medias cells
    • Integer - Class to manage a cell containing an integer value
    • Media - Class to work with a cell containing a value which is a link to a file
    • Medias - Class to manage a cell containing a value which is a link to many files
    • Num - Class to manage a cell containing a numeric value
    • Primary - Class for dealing with a cell of a column which has an auto increment primary key
    • Relation - Abstract class extended by the enum and set cells
    • Set - Class to manage a cell containing many relations separated by comma (set)
    • UserPasswordReset - Class to work with a password reset cell within a user table
    • UserRole - Class to work with the user role cell within a user table
  • Cells - Extended class for a collection of many cells within a same row
  • Col - Extended class to represent an existing column within a table
    • Active - Class for the active column - extends the Yes column class
    • Boolean - Class for the boolean column - a simple yes/no enum relation
    • Context - Class for the context column, updates itself automatically on commit
    • ContextType - Class for the contextType column, a checkbox set relation with all boot types
    • CountCommit - Class for the countCommit column, increments itself automatically on commit
    • Date - Class for a date column, supports many date formats
    • DateAdd - Class for a column which stores the current timestamp when the row is inserted
    • DateLogin - Class for a column which stores the current timestamp when the user logs in
    • DateModify - Class for a column which stores the current timestamp when the row is updated
    • Email - Class for a column managing email
    • Enum - Class for a column containing an enum relation (one)
    • EnvType - Class for the envType column, updates itself automatically on commit
    • Error - Class for a column that manages an error object
    • Files - Abstract class extended by the media and medias cols
    • Floating - Class for a column which deals with floating values
    • Integer - Class for a column which deals with integer values
    • Json - Class for a column which manages json values
    • Media - Class to work with a column containing a value which is a link to a file
    • Medias - Class to work with a column containing a value which is a link to many files
    • Num - Class for a column which deals with numeric values (string, float or int)
    • Pointer - Class for a column which the value is a pointer to another row in the database
    • Primary - Class for dealing with a column which has an auto increment primary key
    • Relation - Abstract class extended by the enum and set columns
    • Request - Class for a column that manages a request object
    • RequestIp - Class for a column which applies the current request ip as value on commit
    • Serialize - Class for a column which should serialize its value
    • Session - Class for a column which should store current session id
    • Set - Class for a column containing a set relation (many)
    • Timezone - Class for a column which is an enum relation to the PHP timezone list
    • Uri - Class for a column managing an uri (relative or absolute)
    • UriAbsolute - Class for a column managing an absolute uri
    • UriRelative - Class for a column managing a relative uri
    • UserActive - Class for the column which manages the active field for the user row
    • UserAdd - Class for a column which stores the current user id on insert
    • UserCommit - Class for a column which stores the current user id on commit
    • UserModify - Class for a column which stores the current user id on update
    • UserPassword - Class for the column which manages the password field for the user row
    • UserPasswordReset - Class for the userPasswordReset column of a user row
    • UserRole - Class for the column which manages the role field for the user row
    • Username - Class for the username column of a user row
    • Yes - Class for the yes column - a simple yes checkbox
  • Cols - Extended class for a collection of many columns within a same table
  • Com - Extended class that provides the logic to store communication messages
  • Db - Extended class used to query the database
  • Error - Extended class used as an error handler
  • File
    • Css - Class for a css or scss file
    • ImageRaster - Class for a pixelated image file
    • Js - Class for a js file
    • Php - Class for a php file
  • Flash - Extended class for a collection containing flash-like data (delete on read)
  • Lang - Extended class for a collection object containing language texts and translations
    • En - English language content used by this namespace
    • Fr - French language content used by this namespace
  • Request - Extended class with methods to manage an HTTP request
  • Role - Extended abstract class that provides more advanced logic for a role
  • Route - Extended abstract class for a route that acts as both a View and a Controller
    • CliCompile - Class for a cli route to compile assets (js and css)
    • CliPreload - Abstract class for a cli route to generate a preload version of the PHP application
    • CliSessionGc - Abstract class for a cli route to remove expired sessions
    • CliVersion - Abstract class for the version route, accessible via the cli
    • Error - Abstract class for an error route
    • Home - Abstract class for a home route
    • Robots - Abstract class for a robots.txt route
    • Sitemap - Abstract class for automated sitemap.xml route
    • _cli - Trait that provides some initial configuration for a cli route
    • _cliClear - Trait for a cli route to remove log files and truncate tables
    • _cliLive - Trait that provides some methods for a cli script which loops
    • _cliOpt - Trait that provides some methods to manage opt in a cli application
  • Row - Extended class to represent an existing row within a table
    • CacheRoute - Class to store rendered route caches
    • Email - Class to deal with a row of the email table, contains the emailModels
    • Lang - Class to work with a row of the lang table, contains the text and translations
    • Log - Class to represent a row of the log table, stores user activities
    • LogCron - Class to represent a row of the logCron table, stores cron jobs results
    • LogEmail - Class to represent a row of the logEmail table, stores emails sent
    • LogError - Class to represent a row of the logError table, stores error objects
    • LogHttp - Class to represent a row of the logHttp table, stores bad HTTP requests
    • LogSql - Class to represent a row of the logSql table, stores sql queries
    • QueueEmail - Class to deal with a row of the queueEmail table, stores the email to send
    • Redirection - Class to work with a row of the redirection table
    • Session - Class to work with a row of the session table
    • User - Class for a row of the user table
    • _emailModel - Trait with methods relative to sending emails from models
    • _log - Trait that adds log-related methods to a row
    • _queue - Trait that adds queuing-related methods to a row
  • Rows - Extended class for a collection of many rows within a same table
  • Service
    • ClassUpload - Class that provides methods to use verot/class.upload.php for resizing images
    • Composer - Class that grants some methods related to the composer autoloader
    • JShrink - Class that provides methods to use tedivm/jshrink for minifying JavaScript
    • PhpMailer - Class that provides methods to use phpmailer/phpmailer in order to send emails
    • PhpPreload - Class used for concatenating a bunch of php files within a single one, for use as preloading
    • ScssPhp - Class that grants methods to use scssphp/scssphp for compiling scss files
  • ServiceMailer - Extended abstract class with basic methods that needs to be extended by a mailing service
  • Session - Extended class that adds session support for user
  • Table - Extended class to represent an existing table within a database
  • _access - Trait that provides methods to useful objects related to the Boot
  • _bootAccess - Trait that provides methods to access the Boot object
  • _dbAccess - Trait that provides a method to access the current database
  • _fullAccess - Trait that provides all access methods related to the Boot

Testing

QuidPHP/Core contains 18 test classes:

  • Boot - Class for testing Quid\Core\Boot
  • Cell - Class for testing Quid\Core\Cell
  • Cells - Class for testing Quid\Core\Cells
  • Col - Class for testing Quid\Core\Col
  • Cols - Class for testing Quid\Core\Cols
  • Com - Class for testing Quid\Core\Com
  • Db - Class for testing Quid\Core\Db
  • Error - Class for testing Quid\Core\Error
  • Lang - Class for testing Quid\Core\Lang
  • Request - Class for testing Quid\Core\Request
  • Role - Class for testing Quid\Core\Role
  • Route - Class for testing Quid\Core\Route
  • Row - Class for testing Quid\Core\Row
  • Rows - Class for testing Quid\Core\Rows
  • ServiceMailer - Class for testing Quid\Core\ServiceMailer
  • Session - Class for testing Quid\Core\Session
  • Suite
    • BootCore - Class for booting the Quid\Core testsuite
  • Table - Class for testing Quid\Core\Table

QuidPHP/Core testsuite can be run by creating a new QuidPHP/Assert project.