malfasih / slim3-json-parser
Parsing JSON response for REST API with CORS management
Installs: 30
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/malfasih/slim3-json-parser
Requires
- php: >=5.5
This package is not auto-updated.
Last update: 2025-12-07 11:28:48 UTC
README
Parsing JSON response for Slim v3 REST API with CORS management - https://projects.alal.io
Installation
Before we get started, please make sure that you have installed Slim 3 Framework. I was using slim-born from HavenShen for developing this module.
$ composer require malfasih/slim3-json-parser
or
composer.json
"require": { "malfasih/slim3-json-parser": "@dev" }
Registering Component
<?php require __DIR__ . '/../vendor/autoload.php'; $app = new \Slim\App(); $container = $app->getContainer(); $container['json'] = function($container) { return new \Malfasih\Slim\JsonParser(); };
Testing
Just with a single line of code, and it actually works.
<?php public function getUserData($request, $response) { return $this->json->print($response, true, 'OK'); }