Download the PHP package paper-cello/paper-cello without Composer
On this page you can find all versions of the php package paper-cello/paper-cello. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download paper-cello/paper-cello
More information about paper-cello/paper-cello
Files in paper-cello/paper-cello
Package paper-cello
Short Description miscellaneous PHP functions
License MIT
Homepage https://github.com/al-codepone/paper-cello
Informations about the package paper-cello
Paper Cello
Paper Cello is a library of miscellaneous PHP functions. There are functions for datetimes, bcrypt hashing, clamping, pagination, routing and SHA1 token generation.
Documentation
All functions have a DocBlock. So you can read the source code or generate documentation with phpDocumentor.
Requirements
PHP 5.3 or greater
Source Code
The project is on GitHub. All the source code is in this file.
Tests
All tests are in the test directory. There is a test for each function; the name of the test script is the function name.
Installation
Install using composer:
or you can install manually:
datetime_now() and datetime_to()
Use datetime_now()
and datetime_to()
to handle datetimes.
These functions handle time zones and daylight saving time correctly
without having to use any other time settings.
Get the current UTC datetime with datetime_now()
:
Use datetime_to()
to convert a UTC datetime to a time zone and format:
bcrypt_hash()
Use bcrypt_hash()
to hash passwords.
Use either a cost value from 4-31:
Or use a previously obtained hash:
clamp()
Clamp a value to a range:
paginate()
Compute total number of pages and current page number given number of items, items per page and raw current page number:
route()
Use route()
to include one of many PHP scripts based on a value.
These examples use echo
; use require
in your application.
Route on the default $_GET['r']
:
Use a base directory:
Route on a POST value:
Route on a value for testing:
There is a shortcut so you don't have to specify keys in the array. For example the below is equivalent to the above:
sha1_token()
Get a random token: