Download the PHP package saritasa/php-common without Composer
On this page you can find all versions of the php package saritasa/php-common. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package php-common
PHP Common classes
Common Saritasa classes and helpers, that can be used universally in any application. This package should not depend on any framework or library.
Usage
Install the package:
Available classes
Enum
Alternative for SplEnum class. Designed to be container for repeatedly used set of constants.
Example:
then somewere in code:
Dto
A simple DTO, that can convert associative array to strong typed class with fields and back:
RegExp
Reusable wrapper for preg_match;
Example:
Exception Definitions
ConfigurationException
Throw this, if you find erroneous configuration.
Example:
PagingException
Throw this, if you implement paging and encounter an unrecoverable problem
PaymentException
Throw this, if you implement payment service or wrapper around payment service and encounter an unrecoverable problem.
Contributing
Requirements
This package must:
- Do not depend on any framework or library
- Do not depend on other Saritasa packages
- Do not register any providers
- Create fork, checkout it
- Develop locally as usual. Code must follow PSR-1, PSR-2 - run PHP_CodeSniffer to ensure, that code follows style guides
- Cover added functionality with unit tests and run PHPUnit to make sure, that all tests pass
- Update README.md to describe new or changed functionality
- Add changes description to Semantic Versioning convention to determine next version number.
- When ready, create pull request
Make shortcuts
If you have GNU Make installed, you can use following shortcuts:
- (instead of ) - run static code analysis with PHP_CodeSniffer to check code style
- (instead of ) - fix code style violations with PHP_CodeSniffer automatically, where possible (ex. PSR-2 code formatting violations)
- (instead of ) - run tests with PHPUnit
-
- instead of
- or just without parameters - invokes described above install, cs, test tasks sequentially - project will be assembled, checked with linter and tested with one single command
Resources
- Bug Tracker
- Code
- Changes History
- Authors