Skip to content

normeno/gjson

Repository files navigation

Gjson

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

Gjson is a PHP library to work under the Google Json Style Guide standard.

Install

Via Composer

$ composer require normeno/gjson

Usage

Remove Empties

$format = new Format();
echo $format->removeEmpty(['foo' => 'bar', 'null' => null, 'empty' => '', 'zero' => 0]);

Set RFC3339

$format = new Format();
echo $format->setRfc3339('1989-10-05');

Convert Snake to Camel

$format = new Format();
echo $format->convertSnakeToCamel([
    'laTaM_cOuNtRy' => 'Chile',
    'latam_REGION'  => 'Metropolitana',
    'LATAM_city'    => 'Santiago'
]);

Set ISO-6793

$format = new Format();
echo $format->setIso6709(['+40.6894', '-074.0447']);

Error Response

$response = new Response();
echo $this->response->error(404, 'File Not Found');

Success Response

$response = new Response();
$data = [
    'items' => [
        'company'   => 'Google',
        'website'   => 'https://www.google.com/'
    ]
];

echo $this->response->success($data);

Change log

Please see CHANGELOG for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details.

Security

If you discover any security related issues, please email ni.ormeno@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

Generate output based on Google JSON style guide

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages