https://github.com/arodbits/phppods
A series of helpful components for building rapid PHP applications.
https://github.com/arodbits/phppods
backend framework laravel php
Last synced: 3 months ago
JSON representation
A series of helpful components for building rapid PHP applications.
- Host: GitHub
- URL: https://github.com/arodbits/phppods
- Owner: arodbits
- License: mit
- Created: 2018-03-21T00:15:29.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-04-05T16:16:55.000Z (almost 8 years ago)
- Last Synced: 2025-08-04T07:54:28.025Z (8 months ago)
- Topics: backend, framework, laravel, php
- Language: PHP
- Homepage:
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PHPpods
A series of helpful components for building rapid PHP applications.
# What's available?
* Array from dot notation
* Create php files on demand by using a template or a stub file
# How to install?
```sh
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:
e.g: Convert an array back from a dot notation
```php
composer install && php UndotterTest.php
```
# How to use it?
All available functions are accessible as follows:
\Axonbits\ComponentName::functionName();
## Arrray from dot notation
Transform back into a multidimensional array, one with flattened key-value pairs from a "dot" notation.
Before calling the function:
```php
\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
```php
[
'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:
--Available: JSON or ARRAY--
e.g:
Return the result as as Json
```php
\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:
```
\Axonbits\Filesystem::
newFile(__DIR__ . '/tmp/SessionClass.php')
->withStub($stubPath = __DIR__ . '/tmp/DummyClass.php', [
'DummyClass' => 'SessionClass',
'DummyTimestamp' => '"2018-01-01"',
'DummyNamespace' => 'App\\Sessions',
])
->write();
```