2017 © Pedro Peláez
 

library php-utils

PHP utils

image

paliari/php-utils

PHP utils

  • Wednesday, April 18, 2018
  • by paliari
  • Repository
  • 1 Watchers
  • 0 Stars
  • 151 Installations
  • PHP
  • 4 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 20 Versions
  • 10 % Grown

The README.md

php-utils

Installation

$ composer require paliari/php-utils

Usage

Bump

Increment version of composer.json., (*1)

Params:, (*2)

  • --git or -g Commit composer.json bumped and create the git tag
  • --version or -v Version type or custom version 1.0.0-pre1. Default is patch
  • --file or -f Composer json file composer.json. Default is composer.json, (*3)

    $ vendor/bin/bump -v major -f custom_composer.json -g
    Or
    $ vendor/bin/bump --version 1.0.0 --file custom_composer.json --git
    Or
    $ vendor/bin/bump -v minor --git
Array

Array facades., (*4)

    $a1 = ['a' => 1];
    $a2 = ['b' => ['b1' => 2]];
    $a3 = \Paliari\Utils\A::merge($a1, $a2);
    var_export($a3);
    // export to ['a' => 1, 'b' => ['b1' => 2]]

    $val = \Paliari\Utils\A::deepKey($a3, 'b.b1');
    var_export($val);
    // export to 2;

    $flatten = \Paliari\Utils\A::flatten($a3);
    var_export($flatten);
    // export to [1, 2];


Function
    // explode string of space, aliases to explode(' ', $str);
    $str = 'a b 1.3d a-x';
    $a = w($str);
    var_export($a);
    // export to ['a', 'b', '1.3d', 'a-x'];

Logger

Write log to file, (*5)


// config custom file log, default is realpath(sys_get_temp_dir()) . '/php-util.log' $file = __DIR__.'/tmp/logs/test.log'; \Paliari\Utils\Logger::file($file); //Methods avaliables: "critical, error, warning, notice, info, debug". // info \Paliari\Utils\Logger::info('Yor custom message.');
CatchFatalError

// Init \Paliari\Utils\CatchFatalError::init(); // Or \Paliari\Utils\CatchFatalError::init(function ($e) { // ... custom handler actions, ex: send mail, save custom log... return $e['message']; });
Url

Facade of url parse., (*6)


// Example $url = 'https://domain.com/home/?p=1&q[a]=11&q[b]=22#/home'; $u = \Paliari\Utils\Url::parse($url); var_export($u); // expected /* Paliari\Utils\Url::__set_state(array( 'scheme' => 'https', 'host' => 'domain.com', 'port' => NULL, 'user' => NULL, 'pass' => NULL, 'path' => '/home/', 'query' => 'p=1&q[a]=11&q[b]=22', 'fragment' => '/home', 'url' => 'https://domain.com/home/?p=1&q[a]=11&q[b]=22#/home', )) */ // Method queryToArray convert query string to array. var_export($u->queryToArray()); // expected /* array ( 'p' => '1', 'q' => array ( 'a' => '11', 'b' => '22', ), ) */

Authors

The Versions

18/04 2018

dev-master

9999999-dev

PHP utils

  Sources   Download

MIT

The Development Requires

18/04 2018

1.1.17

1.1.17.0

PHP utils

  Sources   Download

MIT

The Development Requires

17/05 2017

1.1.16

1.1.16.0

PHP utils

  Sources   Download

MIT

The Development Requires

03/05 2017

1.1.15

1.1.15.0

PHP utils

  Sources   Download

MIT

The Development Requires

29/04 2017

1.1.14

1.1.14.0

PHP utils

  Sources   Download

MIT

The Development Requires

29/04 2017

1.1.13

1.1.13.0

PHP utils

  Sources   Download

MIT

The Development Requires

28/04 2017

1.1.12

1.1.12.0

PHP utils

  Sources   Download

MIT

The Development Requires

20/01 2017

1.1.11

1.1.11.0

PHP utils

  Sources   Download

MIT

The Development Requires

18/01 2017

1.1.10

1.1.10.0

PHP utils

  Sources   Download

MIT

The Development Requires

18/01 2017

1.1.9

1.1.9.0

PHP utils

  Sources   Download

MIT

The Development Requires

18/01 2017

1.1.8

1.1.8.0

PHP utils

  Sources   Download

MIT

The Development Requires

18/01 2017

1.1.7

1.1.7.0

PHP utils

  Sources   Download

MIT

The Development Requires

17/01 2017

1.1.6

1.1.6.0

PHP utils

  Sources   Download

MIT

The Development Requires

17/01 2017

1.1.5

1.1.5.0

PHP utils

  Sources   Download

MIT

The Development Requires

17/01 2017

1.1.4

1.1.4.0

PHP utils

  Sources   Download

MIT

The Development Requires

17/01 2017

1.1.3

1.1.3.0

PHP utils

  Sources   Download

MIT

The Development Requires

17/01 2017

1.1.2

1.1.2.0

PHP utils

  Sources   Download

MIT

The Development Requires

17/01 2017

1.1.1

1.1.1.0

PHP utils

  Sources   Download

MIT

The Development Requires

17/01 2017

1.1.0

1.1.0.0

PHP utils

  Sources   Download

MIT

The Development Requires

16/01 2017

1.0.0

1.0.0.0

PHP utils

  Sources   Download

MIT

The Development Requires