Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/maikuolan/common
Common Classes Package.
https://github.com/maikuolan/common
cache caching classes common curl demojibakefier hacktoberfest l10n mojibake package php request strings transformation yaml
Last synced: about 2 months ago
JSON representation
Common Classes Package.
- Host: GitHub
- URL: https://github.com/maikuolan/common
- Owner: Maikuolan
- License: gpl-2.0
- Created: 2019-01-24T15:55:13.000Z (almost 6 years ago)
- Default Branch: v2
- Last Pushed: 2024-09-20T05:47:14.000Z (3 months ago)
- Last Synced: 2024-10-13T13:09:36.480Z (2 months ago)
- Topics: cache, caching, classes, common, curl, demojibakefier, hacktoberfest, l10n, mojibake, package, php, request, strings, transformation, yaml
- Language: PHP
- Homepage:
- Size: 1.01 MB
- Stars: 7
- Watchers: 4
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: Changelog.txt
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE.txt
- Security: SECURITY.md
Awesome Lists containing this project
README
![v1: PHP >= 5.4 < 8.4](https://img.shields.io/badge/v1-PHP%20%3E%3D%205.4%20%3C%208.4-8892bf.svg)
![v2: PHP >= 7.2](https://img.shields.io/badge/v2-PHP%20%3E%3D%207.2-8892bf.svg)
[![License: GPL v2](https://img.shields.io/badge/License-GPL%20v2-blue.svg)](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html)## Common Classes Package.
The common classes package is intended to provide some of the classes that I originally wrote for common use by CIDRAM, phpMussel, etc as a separate, redistributable package, available to be readily integrated and used with other projects and packages via Composer.
All classes in the common classes package use the namespace `Maikuolan\Common`.
The common classes package currently contains the following classes:
- **[Cache](https://github.com/Maikuolan/Common/blob/v2/_docs/Cache.md)**: A simple, unified cache handler used by the CIDRAM and phpMussel projects for their caching needs. Currently, it supports APCu, Memcached, Redis, PDO, and flatfile caching.
- **[CommonAbstract](https://github.com/Maikuolan/Common/blob/v2/_docs/CommonAbstract.md)**: Common abstract for the common classes package. Not to be instantiated directly; To be extended by the other classes.
- **[ComplexStringHandler](https://github.com/Maikuolan/Common/blob/v2/_docs/ComplexStringHandler.md)**: The complex string handler class provides an easy way to iterate over the parts of a given string, identified by a given pattern, in order to execute a given closure to those parts of the given string, or to the glue that separates those parts.
- **[DelayedIO](https://github.com/Maikuolan/Common/blob/v2/_docs/DelayedIO.md)**: Provides an easy, simple solution for when needing to read and update a number of files, but delay rewriting the files for a while.
- **[Demojibakefier](https://github.com/Maikuolan/Common/blob/v2/_docs/Demojibakefier.md)**: Intended to normalise the character encoding of a given string to a preferred character encoding when the given string's byte sequences don't match the expectations of the preferred character encoding. Useful in cases where a block of data might conceivably be composed of several different unspecified, unknown encodings.
- **[Events](https://github.com/Maikuolan/Common/blob/v2/_docs/Events.md)**: Allows the orchestration of "events" throughout a codebase by providing some simple methods to assign handlers to a particular event and to subsequently invoke those handlers at a later point in the codebase where the "event" is to occur.
- **[IPHeader](https://github.com/Maikuolan/Common/blob/v2/_docs/IPHeader.md)**: Attempts to resolve an originating IP address from a preferred source, or `REMOTE_ADDR` if the preferred source isn't available.
- **[L10N](https://github.com/Maikuolan/Common/blob/v2/_docs/L10N.md)**: Used by the CIDRAM and phpMussel projects to handle L10N data, the L10N handler reads in an array of L10N strings and provides some safe and simple methods for manipulating and returning those strings when needed, and for handling cardinal plurals, where integers and fractions are concerned alike, based upon the pluralisation rules specified by the L10N from a range of various pluralisation rules available, to be able to suit the needs of most known languages.
- **[Matrix](https://github.com/Maikuolan/Common/blob/v2/_docs/Matrix.md)**: Facilitates the generation of multidimensional arrays to an arbitrarily specified depth and number of elements, and facilitates iteration through those multidimensional arrays in any direction (whether up and down a particular a array, across different depths, etc) via arbitrary callables and closures.
- **[NumberFormatter](https://github.com/Maikuolan/Common/blob/v2/_docs/NumberFormatter.md)**: Used by the CIDRAM and phpMussel projects to format numbers generated by their front-end pages, the class provides a more controllable, customisable mechanism for number formatting than PHP's internal `number_format()` function.
- **[Operation](https://github.com/Maikuolan/Common/blob/v2/_docs/Operation.md)**: Used by the CIDRAM and phpMussel projects for various operations related to dependency management (an integral part of the internal updates system).
- **[Request](https://github.com/Maikuolan/Common/blob/v2/_docs/Request.md)**: Used by the CIDRAM and phpMussel projects to send outbound requests through cURL.
- **[YAML](https://github.com/Maikuolan/Common/blob/v2/_docs/YAML.md)**: Used by the CIDRAM and phpMussel projects to handle YAML data.---
### How to install:
The recommended way to install it is by using Composer:
`composer require maikuolan/common`
You can, however, download the classes you need from this repository manually, if you want to do so.
After you've downloaded the package, or any needed classes, [PSR-4](https://www.php-fig.org/psr/psr-4/) autoloading is preferred way to access the classes (particularly if you're using a large number of different, unrelated classes). If you're installing the package via Composer, all you have to do is `require_once 'vendor/autoload.php';` and everything will be taken care of. Alternatively, if you're installing the package or its classes manually (or without Composer), or if you don't want to use a PSR-4 autoloader, you can simply require or include any needed classes into your projects by using an include or require statement in your code, to point to the needed classes in any PHP code that needs them.
---
### Other information:
#### Licensing:
Provided using the [GNU General Public License version 2.0](https://github.com/Maikuolan/Common/blob/v2/LICENSE.txt) (GPLv2).#### For support:
Please use the issues page of this repository.#### For contributors:
[\[CONTRIBUTING.md\] **Want to help?**](https://github.com/Maikuolan/Common/blob/v2/CONTRIBUTING.md)---
Last Updated: 31 May 2024 (2024.05.31).