2017 © Pedro Peláez
 

library phppods

PHP helper

image

thonyx/phppods

PHP helper

  • Thursday, April 5, 2018
  • by anthony2727
  • Repository
  • 1 Watchers
  • 0 Stars
  • 16 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

PHPpods

A series of helpful components for building rapid PHP applications., (*1)

What's available?

  • Array from dot notation
  • Create php files on demand by using a template or a stub file

How to install?

composer require thonyx/phppods 

Want to see it in action?

Run a test! After installing the package, go to --from within your PHP project-- /vendor/thonyx/phppods and run:, (*2)

e.g: Convert an array back from a dot notation, (*3)

composer install && php UndotterTest.php

How to use it?

All available functions are accessible as follows:, (*4)

\Axonbits\ComponentName::functionName();, (*5)

Arrray from dot notation

Transform back into a multidimensional array, one with flattened key-value pairs from a "dot" notation., (*6)

Before calling the function:, (*7)

\Axonbits\Arrays::undot[
    'name'=>'Yale', 
    'timeseries.2014.enrollment'=>'1',
    'timeseries.2014.cost'=>'100',
    'timeseries.2015.enrollment'=>'200',
    'timeseries.2015.cost'=>'200',
    'groups.colors.default'=>'#white',
    'groups.colors.blue'=>'#lalala'
]);

After calling the function, (*8)

[
  'name' => 'Yale',
  'timeseries' =>
  [
    2014 =>
    [
      'enrollment' => '1',
      'cost' => '100',
    ],
    2015 =>
    [
      'enrollment' => '200',
      'cost' => '200',
    ],
  ],
  'groups' =>
  [
    'colors' =>
    [
      'default' => '#white',
      'blue' => '#lalala',
    ],
  ],
]

When transforming arrays you can specify the format the function call should return the response:, (*9)

--Available: JSON or ARRAY--, (*10)

e.g: Return the result as as Json, (*11)

\Axonbits\Arrays::toJson()->undot[
    'name'=>'Yale', 
    'timeseries.2014.enrollment'=>'1',
    'timeseries.2014.cost'=>'100',
    'timeseries.2015.enrollment'=>'200',
    'timeseries.2015.cost'=>'200',
    'groups.colors.default'=>'#white',
    'groups.colors.blue'=>'#lalala'
]);

Filesystem: Create files from a template or stub file

Example:, (*12)

\Axonbits\Filesystem::
    newFile(__DIR__ . '/tmp/SessionClass.php')
    ->withStub($stubPath = __DIR__ . '/tmp/DummyClass.php', [
        'DummyClass'     => 'SessionClass',
        'DummyTimestamp' => '"2018-01-01"',
        'DummyNamespace' => 'App\\Sessions',
    ])
    ->write();

The Versions

05/04 2018

dev-master

9999999-dev

PHP helper

  Sources   Download

MIT

The Requires

 

by Anthony Rodriguez

04/04 2018

1.0.1

1.0.1.0

PHP helper

  Sources   Download

MIT

The Requires

 

by Anthony Rodriguez

21/03 2018

v1.0.0

1.0.0.0

PHP helper

  Sources   Download

MIT

by Anthony Rodriguez