2017 © Pedro Peláez
 

library php-helper

Help libraries for PHP development

image

codepso/php-helper

Help libraries for PHP development

  • Sunday, July 22, 2018
  • by codepso
  • Repository
  • 1 Watchers
  • 0 Stars
  • 10 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 11 Versions
  • 25 % Grown

The README.md

Codepso

php-helper

Help libraries for PHP development, (*1)

Table of content

Requirements

PHP Helper has the following requirements: - PHP 7.0+ Image manipulation The Imagine Helper has the following requirements: - Imagine 1.0.1+ - GD, (*2)

Installation

composer require codepso/php-helper

MainHelper

isValid($params, $rules)

populate($object, $data, $ignore)

getIgnoredAttributes($object, $attr)

getClass($object, $namespace)

getElapsed($date)

generatePassword($length)

isJSON($string)

ImageHelper

createThumbnail($filename, $params)

  • $filename: string | required Name of the image
  • $params: array | required
    • path: string | required Path of the image
    • filter: string | required Resize info ex: 300x200, 100x100
    • ratio: int | optional Inset:1 (default), Outbound: 2
    • rename: string | optional New name of the image
<?php
require_once 'vendor/autoload.php';

use Codepso\PHPHelper\ImageHelper;

try {

    // ratio: 1 (inset)
    $p = ['path' => 'assets/files', 'filter' => '200x200'];
    $r1 = ImageHelper::createThumbnail('teddy.png', $p);
    if (!$r1->status) {
        throw new \Exception($r1->message);
    }

    // ratio: 2 (outbound)
    $p = ['path' => 'assets/files', 'filter' => '200x200', 'rename' => 'teddy-2.png',  'ratio' => 2];
    $r2 = ImageHelper::createThumbnail('teddy.png', $p);
    if (!$r2->status) {
        throw new \Exception($r2->message);
    }

} catch (\Exception $e) {
    $e->getMessage();
}
Original Inset (200x200) Outbound (200x200)
366x232px 200x127px 200x200px
or in ou

saveBase64($params, $path)

  • $params: array | required
    • filename: string | required Name of the image
    • value: string | required Image in base64 format
    • rename: string | optional New name of the image
  • $path: string | required The path to save the file
<?php
require_once 'vendor/autoload.php';

use Codepso\PHPHelper\ImageHelper;

try {

    $p = [
        'filename' => 'box.png',
        'value' => 'iVBORw0KGgoAAAANSUhEUgAAABoAAAAYAQMAAADeTH+GAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAA1BMVEWIkr9Q9TFnAAAAC0lEQVQIHWMYIAAAAHgAASxSckIAAAAASUVORK5CYII='
    ];
    $r = ImageHelper::saveBase64($p, 'assets/files');
    if (!$r->status) {
        throw new \Exception($r->message);
    }

} catch (\Exception $e) {
    $e->getMessage();
}

JWTHelper

encode($data, $scope)

encode($jwt, $scope)

Test

We are using Codeception, (*3)

php vendor/bin/codecept run unit ImageHelperTest
php vendor/bin/codecept run unit
php vendor/bin/codecept run ImageHelperTest:testSaveBase64
php vendor/bin/codecept run ImageHelperTest:testSaveBase64WithNewName

License

The Aimeos TYPO3 extension is licensed under the terms of the GPL Open Source license and is available for free., (*4)

  • https://imagine.readthedocs.io/en/stable

The Versions

22/07 2018

dev-master

9999999-dev

Help libraries for PHP development

  Sources   Download

MIT

The Requires

 

by Juan Minaya Leon

php helper php symfony helper symfony helper

22/07 2018

v1.0.9

1.0.9.0

Help libraries for PHP development

  Sources   Download

MIT

The Requires

 

by Juan Minaya Leon

php helper php symfony helper symfony helper

05/03 2018

v1.0.8

1.0.8.0

Help libraries for PHP development

  Sources   Download

MIT

The Requires

 

by Juan Minaya Leon

php helper php symfony helper symfony helper

05/03 2018

v1.0.7

1.0.7.0

Help libraries for PHP development

  Sources   Download

MIT

The Requires

 

by Juan Minaya Leon

php helper php symfony helper symfony helper

05/03 2018

v1.0.6

1.0.6.0

Help libraries for PHP development

  Sources   Download

MIT

The Requires

 

by Juan Minaya Leon

php helper php symfony helper symfony helper

26/02 2018

v1.0.5

1.0.5.0

Help libraries for PHP development

  Sources   Download

MIT

The Requires

 

by Juan Minaya Leon

php helper php symfony helper symfony helper

26/02 2018

v1.0.4

1.0.4.0

Help libraries for PHP development

  Sources   Download

MIT

The Requires

 

by Juan Minaya Leon

php helper php symfony helper symfony helper

26/02 2018

v1.0.3

1.0.3.0

Help libraries for PHP development

  Sources   Download

MIT

The Requires

 

by Juan Minaya Leon

php helper php symfony helper symfony helper

26/02 2018

v1.0.1

1.0.1.0

Help libraries for PHP development

  Sources   Download

MIT

The Requires

 

by Juan Minaya Leon

php helper php symfony helper symfony helper

26/02 2018

v1.0.2

1.0.2.0

Help libraries for PHP development

  Sources   Download

MIT

The Requires

 

by Juan Minaya Leon

php helper php symfony helper symfony helper

26/02 2018

v1.0.0

1.0.0.0

Help libraries for PHP development

  Sources   Download

MIT

The Requires

 

by Juan Minaya Leon

php helper php symfony helper symfony helper