phpzm / phpee
Library with same handlers to make php easier
Installs: 1 500
Dependents: 2
Suggesters: 0
Security: 0
Stars: 4
Watchers: 3
Forks: 0
Open Issues: 0
README
Este é um projeto que tem como objetivo nivelar a experiência de uso da API do PHP criando wrappers para os recursos da linguagem e entregando helpers que quase todo projeto necessita.
Um exmplo, ao invés de usar file_put_contents()
podemos usar Php\File::write()
Pseudônimos para as Extensões:
Base64
-
string encode(string $string)
alias: https://php.net/base64_encode
ex.: Php\Base64::encode(string); -
string decode(string $string, bool $strict = null)
alias: https://php.net/base64_decode
ex.: Php\Base64::decode(string, boolean);
Encode
-
string ascii(string $string)
alias: https://php.net/ord
ex.: Php\Encode::ascii(string); -
string soundex(string $string)
alias: https://php.net/soundex
ex.: Php\Encode::soundex(string);
File
-
int write(string $filename, mixed $data, int $flags = 0, resource $context = null)
alias: https://php.net/file_put_contents
ex.: Php\File::write(string, mixed, int, resource); -
string read(string $filename, bool $use_include_path = false, resource $context = null, int $offset = 0, int $maxlen = null)
alias: https://php.net/file_get_contents
ex.: Php\File::read(string, boolean, resource, ìnt, ìnt); -
bool exists(string $filename)
alias: https://php.net/file_exists
ex.: Php\File::exists(string);
Hash
-
string md5(string $string, bool $raw = false)
alias: https://php.net/md5
ex.: Php\Hash::md5(string, bool); -
string sha1(string $string, bool $raw = false)
alias: https://php.net/sha1
ex.: Php\Hash::sha1(string, bool);
JSON
-
string encode(mixed $value, int $options = 0, int $depth = 512)
alias: https://php.net/json_encode
ex.: Php\JSON::encode(string, int, int); -
string decode(string $json, bool $assoc = false, int $depth = 512, int $options = 0)
alias: https://php.net/json_decode
ex.: Php\JSON::decode(string, bool, int, int);
Regex
-
string split($pattern, string $subject, int $limit = -1, int $flags = 0)
alias: https://php.net/preg_split
ex.: Php\Regex::split(string, string, int, int);
Text
-
int length(string $string)
alias: https://php.net/strlen
ex.: Php\Text::length(string); -
string replace(string $string, string $search, string $replace)
alias: https://php.net/str_replace
ex.: Php\Text::replace(string, string, string); -
mixed first(string $string, string $search)
alias: https://php.net/strpos
ex.: Php\Text::first(string, string); -
mixed last(string $string, string $search)
alias: https://php.net/strrchr
ex.: Php\Text::last(string, string); -
string upper(string $string)
alias: https://php.net/strtoupper
ex.: Php\Text::upper(string); -
string lower(string $string)
alias: https://php.net/strtolower
ex.: Php\Text::lower(string); -
string capitalize(string $string)
alias: https://php.net/ucwords
ex.: Php\Text::capitalize(string); -
string unCapitalize(string $string)
alias: https://php.net/lcfirst
ex.: Php\Text::unCapitalize(string); -
array split(string $delimiter, string $string, int $limit = null)
alias: https://php.net/explode
ex.: Php\Text::split(string, string, int); -
string join(string $glue, array $pieces)
alias: https://php.net/implode
ex.: Php\Text::join(string, array); -
string levenshtein(string $a, string $b)
alias: https://php.net/levenshtein
ex.: Php\Text::levenshtein(string, string); -
string substring(string $string , int $start, int $length = null)
alias: https://php.net/substr
ex.: Php\Text::substring(string, int, int); -
string trim(string $string , string $characters = null)
alias: https://php.net/trim
ex.: Php\Text::trim(string, string); -
string wrap(string $string , int $width = 75, string $break = "\n", bool $cut = false)
alias: https://php.net/wordwrap
ex.: Php\Text::wrap(string, int, string, bool); -
int compare(string $a, string $b)
alias: https://php.net/strcmp
ex.: Php\Text::compare(string, string); -
array divide(string $string, int $length = 1)
alias: https://php.net/str_split
ex.: Php\Text::divide(string, int); -
string shuffle(string $string)
alias: https://php.net/str_shuffle
ex.: Php\Text::shuffle(string); -
string repeat(string $string, int $multiplier)
alias: https://php.net/str_repeat
ex.: Php\Text::repeat(string, int);
Recursos Adicionais:
Http
-
mixed post(string $index)
Pega um valor do $_POST
ex.: Php\Http::post(string) -
mixed get(string $index)
Pega um valor do $_GET
ex.: Php\Http::post(string) -
mixed file(string $index)
Pega um valor do $_FILES
ex.: Php\Http::post(string) -
mixed all($index = null)
Pega um valor do $_REQUEST
ex.: Php\Http::all(string)