quidphp/main

PHP library that provides a set of base objects and collections

5.31.0 2022-07-02 22:21 UTC

This package is auto-updated.

Last update: 2024-11-11 01:01:52 UTC


README

Release License PHP Version Style CI Code Size

About

QuidPHP/Main is a PHP library that provides a set of base objects and collections that can be extended to build something more specific. It is part of the QuidPHP package and can also be used standalone.

License

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

Documentation

QuidPHP/Main documentation is available at QuidPHP/Docs.

Installation

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

$ composer require quidphp/main

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

Requirement

QuidPHP/Main requires the following:

Dependency

QuidPHP/Main has the following dependency:

  • quidphp/base - Quid\Base - PHP library that provides a set of low-level static methods

The dependency will be resolved by using the Composer installation process.

Comment

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

Convention

QuidPHP/Main is built on the following conventions:

  • 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.
  • Dynamic: Classes are dynamic and objects need to be instantiated, very few static methods
  • Interfaces: Interfaces are stored within the Contract subdirectory.
  • Traits: Traits filenames start with an underscore (_).
  • Type: Files, function arguments and return types are strict typed.

Overview

QuidPHP/Main contains 118 classes, traits and interfaces. Here is an overview:

  • ArrMap - Abstract class that provides base methods to make a collection
  • ArrObj - Abstract class that implements the methods necessary for the ArrayAccess, Countable and Iterator interfaces
  • Arrs - Class for a collection containing a multidimensional array
  • Autoload - Class that provides custom autoloading logic, including alias autoloading and class within closures
  • Calendar - Class that provides logic for the calendar widget
  • Cart - Class used to to manage a cart containing different items
  • CatchableException - Class for a catchable exception
  • Com - Class that provides the logic to store positive, negative or neutral communication messages
  • Concatenator - Class used to concatenate the content of many files or directories
  • Contract
    • Cache - Interface to detail the methods required for implementing caching functionality to an object
    • Catchable - Interface to mark an exception as catchable
    • Email - Interface to describe methods of an objet containing an email
    • FileStorage - Interface to describe a file objet which has a defined storage folder
    • Hierarchy - Interface to describe the methods required to access the hierarchy of an objet
    • Import - Interface to precise the methods required for being able to import and export to an objet
    • Log - Interface to detail the methods required for implementing logging functionality to an object
    • Meta - Interface to describe methods making an objet a source of meta-data
    • Queue - Interface to detail the methods required for implementing queuing functionality to an object
    • Session - Interface to detail the methods required for an objet to be a session storage
  • Error - Class used as a basic error handler
  • Exception - Class for a default exception
  • Extender - Class for a collection containing a list of classes extending others
  • Extenders - Class for a collection containing many extender objects
  • File - Class for a basic file object
    • Audio - Class for an audio file (like mp3)
    • Binary - Abstract class for a binary file
    • Cache - Class for a cache storage file
    • Calendar - Class for a calendar file (like ics)
    • Css - Class for a css or scss file
    • Csv - Class for a csv file
    • Doc - Class for a doc file, like microsoft word
    • Dump - Class for file which contains an exported value (similar to var_export)
    • Email - Class for a file which is an email (in json format)
    • Error - Class for an error storage file
    • Font - Class for a font file (like ttf)
    • Html - Class for an html file
    • Image - Abstract class for an image file (raster or vector)
    • ImageRaster - Class for a pixelated image file
    • ImageVector - Class for a vector image file (like svg)
    • Js - Class for a js file
    • Json - Class for a json file
    • Log - Class for a log storage file
    • Pdf - Class for pdf file
    • Php - Class for a php file
    • Queue - Class for a queue storage file
    • Serialize - Class for a file with content that should be serialized
    • Session - Class for a session storage file, which is serialized
    • Text - Abstract class for a text file
    • Txt - Class for txt file (like txt)
    • Video - Class for a video file (like mp4)
    • Xml - Class for an xml file
    • Zip - Class for a zip file
    • _concatenate - Trait with methods to concatenate files and directories
    • _log - Trait that grants methods to allow a file object to do logging
    • _storage - Trait that provides methods to link a file object to a specific storage directory
  • Files - Class for a collection containing many file objects
  • Flash - Class for a collection containing flash-like data (delete on read)
  • Importer - Class providing the logic to export data from an objet and importing into another one
  • Insensitive - Class for a collection containing an insensitive array
  • Insert - Class for a collection containing an insert-only array (cannot update)
  • Lang - 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
    • _overload - Trait which implements the overload logic for the lang classes
  • Localization - Class for storing localization data, like latitude and longitude
  • Map - Class that provides a set of methods for a collection
    • _arr - Trait that provides methods to allow advanced unidimensional array manipulation to a collection
    • _arrs - Trait that provides methods to allow advanced multidimensional array manipulation to a collection
    • _basic - Trait that provides simple boolean methods to analyze the type of array within the collection
    • _classe - Trait that grants methods to work with a collection containing fully qualified class name strings
    • _classeObj - Trait that gives methods to work with a collection containing fqcn strings or objects
    • _cloner - Trait that provides a method to make sure the collection is cloned on every update
    • _count - Trait that provides a method to limit the length of a collection
    • _filter - Trait that provides a method to filter a collection by providing a condition or callback
    • _flash - Trait that grants methods for the collection to delete an entry once it has been retrieved
    • _insensitive - Trait that transforms the collection from case sensitive to insensitive
    • _map - Trait that provides a method to recursively change the entries (map) by providing a callback
    • _nav - Trait that provides methods to a collection in order to work with pagination
    • _obj - Trait that grants methods to work with a collection containing instantiated objects
    • _prepend - Trait that replaces methods to make the collection prepend per default (add at the beginning)
    • _readOnly - Trait that provides a simple readOnly lock to a collection
    • _reference - Trait that permits the collection to work from a reference array source
    • _sequential - Trait that makes sure the keys of the collection are always sequential
    • _sort - Trait that provides methods to change the order of entries within the collection
  • MapObj - Class for a collection containing objects
  • Request - Class with methods to manage an HTTP request
  • RequestHistory - Class for a collection containing an history of requests
  • Res - Class with methods to manage a resource
  • Response - Class with methods to manage an HTTP response
  • ResponseCurrent - Class for an object that acts as representation of current response
  • Role - Class that provides basic logic for a role
  • Roles - Class for a collection containing many roles
  • Root - Abstract class extended by all others
  • Service - Abstract class that provides basic methods to manage a third-party service
  • ServiceMailer - Abstract class with basic methods that needs to be extended by a mailing service
  • ServiceRequest - Abstract class with basic methods for a service that works with HTTP request
  • ServiceVideo - Abstract class with basic methods for a service that provides a video object after an HTTP request
  • Services - Class for a collection containing many service objects
  • Session - Class that implements the methods necessary for the SessionHandlerInterface interface
  • Std - Class for a collection with a complete set of methods
  • Timeout - Class for a collection containing timeout data (to deny an action if it already has happened too much)
  • Update - Class for a collection containing an update-only array (cannot insert after initialization)
  • Video - Class for an object representing a video with some meta-data
  • Widget - Abstract class that provides basic methods for a widget
  • Xml - Class that provides basic methods to make an XML sitemap
  • _arrObj - Trait that provides methods to respect the ArrayAccess, Countable and Iterator native interfaces
  • _attr - Trait that grants methods to work with the dynamic property attr
  • _attrPermission - Trait that provides methods to work with permissions in attr
  • _cache - Trait that provides methods to get or set a cached value from an object
  • _email - Trait that provides methods to use the object as an email
  • _inst - Trait that provides methods to store an instantiated objet within a static property
  • _log - Trait that provides a required method to allow logging with the object
  • _overload - Trait that allows a class to retrieve its overloaded version - higher up in the class hierarchy
  • _queue - Trait that provides methods required for implementing queuing functionality to an object
  • _root - Trait that provides basic object methods and magic methods
  • _rootClone - Trait that provides a default __clone magic function
  • _serialize - Trait that provides methods for serializing and unserializing object
  • _throw - Trait that provides static methods to throw exception from an object

Testing

QuidPHP/Main contains 34 test classes:

  • Arrs - Class for testing Quid\Main\Arrs
  • Autoload - Class for testing Quid\Main\Autoload
  • Calendar - Class for testing Quid\Main\Calendar
  • Cart - Class for testing Quid\Main\Cart
  • CatchableException - Class for testing Quid\Main\CatchableException
  • Com - Class for testing Quid\Main\Com
  • Concatenator - Class for testing Quid\Main\Concatenator
  • Error - Class for testing Quid\Main\Error
  • Exception - Class for testing Quid\Main\Exception
  • Extender - Class for testing Quid\Main\Extender
  • Extenders - Class for testing Quid\Main\Extenders
  • File - Class for testing Quid\Main\File
  • Files - Class for testing Quid\Main\Files
  • Flash - Class for testing Quid\Main\Flash
  • Importer - Class for testing Quid\Main\Importer
  • Insensitive - Class for testing Quid\Main\Insensitive
  • Insert - Class for testing Quid\Main\Insert
  • Lang - Class for testing Quid\Main\Lang
  • Localization - Class for testing Quid\Main\Localization
  • Map - Class for testing Quid\Main\Map
  • MapObj - Class for testing Quid\Main\MapObj
  • Request - Class for testing Quid\Main\Request
  • RequestHistory - Class for testing Quid\Main\RequestHistory
  • Res - Class for testing Quid\Main\Res
  • Response - Class for testing Quid\Main\Response
  • ResponseCurrent - Class for testing Quid\Main\ResponseCurrent
  • Role - Class for testing Quid\Main\Role
  • Roles - Class for testing Quid\Main\Roles
  • Session - Class for testing Quid\Main\Session
  • Std - Class for testing Quid\Main\Std
  • Timeout - Class for testing Quid\Main\Timeout
  • Update - Class for testing Quid\Main\Update
  • Video - Class for testing Quid\Main\Video
  • Xml - Class for testing Quid\Main\Xml

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