globalxtreme / response
GlobalXtreme Response Pattern
Installs: 239
Dependents: 3
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/globalxtreme/response
Requires
- php: 8.*
- globalxtreme/parser: ^2.0
- illuminate/console: ^8.0|^9.0|^10.0|^11.0
- illuminate/support: ^8.83|^9.0|^10.0|^11.0
- dev-master
- v2.0.x-dev
- 2.0.4
- 2.0.3
- 2.0.2
- 2.0.1
- v2.0.0
- v1.1.x-dev
- 1.1.13
- 1.1.12
- v1.1.11
- 1.1.10
- 1.1.9
- 1.1.8
- 1.1.7
- 1.1.6
- 1.1.5
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- v1.0.x-dev
- 1.0.24
- 1.0.23
- 1.0.22
- 1.0.21
- 1.0.18
- 1.0.17
- 1.0.16
- 1.0.15
- 1.0.14
- 1.0.13
- 1.0.12
- 1.0.11
- 1.0.10
- 1.0.9
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.1
- 1.0.0
This package is auto-updated.
Last update: 2025-09-24 07:39:35 UTC
README
Install with composer
To install with Composer, simply require the latest version of this package.
composer require globalxtreme/response
Using
- Install custom constant error/success and helpers with command.
php artisan globalxtreme:response-install
- Copy helpers file path app/Packages/Response/Status/globals.php to composer.json
{ "autoload": { "files": [ "app/Packages/Response/Status/globals.php" ] } }
- You can add custom helpers function for error/success response in app/Packages/Response/Status/globals.php
use App\Packages\Response\Constant\Error; if (!function_exists("errTestingCustom")) { function errTestingCustom($internalMsg = "") { error(Error::DEFAULT, $internalMsg); } }
- Using response with controller.
use App\Http\Controllers\Controller; use App\Models\Custom; use GlobalXtreme\Parser\Parser; use GlobalXtreme\Response\Response; use GlobalXtreme\Response\Status; class CustomController extends Controller { public function testing() { // Get more than one data $customs = Custom::get(); // Display data auto call parser from Response package $results = success($customs); // Display data using parser class $result = success(Parser::get($customs)); // Get one data $custom = Custom::first(); // Display data auto call parser from Response package $result = success($custom); // Display data using parser class $result = success(Parser::first($custom)); // Get data with pagination $customs = Custom::paginate(10); // Display data auto call parser from Response package $results = success($customs); // Display data using parser class and manual process pagination $results = success(Parser::get($customs), pagination: pagination($customs)); // Display response using Response::class $status = new Status(true); // You can choose response type json/object $results = Response::json($status, $customs); $results = Response::object($status, $customs); } }