chihyulin66/laravel-json-helper

v1.0.0 2022-11-03 08:04 UTC

This package is auto-updated.

Last update: 2025-06-29 02:16:31 UTC


README

introduction

I just want json encode/decode beautifully.

install

Install the package via composer

composer require chihyulin66/laravel-json-helper

Add Provider to config/app.php:

'providers' => [
    /*
     * Package Service Providers...
     */
   ChihYuLin66\LaravelJsonHelper\JsonServiceProvider::class
]

Add the Facade in config/app.php:

'aliases' => [
    // ...
    'Json' => ChihYuLin66\LaravelJsonHelper\JsonFacade::class,
]

Usage

// use
use ChihYuLin66\LaravelJsonHelper\Json;

$json = Json::encode($value);
$value = Json::decode($json);

// anywhere 
$json = app('json')->encode($value);
$value = app('json')->decode($json);