Simple functions to format data.
- Date (days ago, yesterday, an hour ago...)
- Numbers (creditcard, cpf, cnpj)
- Units (meter, liter)
- PHP 5.3
How to use
You can set up Formattter for autoloading:
set_include_path('/my/library' . PATH_SEPARATOR . get_include_path()); require_once 'SplClassLoader.php'; $myLoader = new \SplClassLoader(); $myLoader->register();
Formattter is namespaced, but you can make your life easier by importing a single class into your context:
<?php use Formattter\Formattter as f;
Use something like this:
$cep = 11222333; echo f::cep($cep); // 11222-333
- This library is inspired and heavily influenced by Respect/Validation, the most awesome validation engine ever created for PHP.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.