Download the PHP package ysm/responsable without Composer

On this page you can find all versions of the php package ysm/responsable. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package responsable

YSM Responsable

A Laravel package that provides standardized response macros for both JSON (API) and web (redirect) responses, along with helper functions to manage session data. It adds success and error macros to the Response facade (for JSON) and RedirectResponse class (for web), and provides responsable() and responsable_forget() helpers for session data management in Laravel 12+ applications.

Features

Requirements

Installation

Install the package via Composer:

The package uses Laravel's auto-discovery to register the ResponsableServiceProvider. If auto-discovery is disabled, manually add the provider to config/app.php:

Usage

The package provides success and error macros for both JSON responses (via Response facade or response() helper) and web redirects (via RedirectResponse), along with helper functions responsable() and responsable_forget() for session data management.

JSON Response Macros

Example 1: Fetching a Collection of Posts

Return a collection of posts with a JSON success response:

Output:

Example 2: Fetching Paginated Posts

Return paginated posts with metadata:

Output:

Example 3: Handling JSON Errors

Return an error response when a condition fails:

Output (Error):

Use apiSuccess() || apiError() Helpers

You can also use the success() and error() helpers for cleaner syntax:

Web Redirect Macros

Example 4: Success Redirect with Session Data

Redirect with a success message stored in the session:

Session Data (accessible via responsable()):

Example 5: Error Redirect with Validation Errors

Redirect with an error message and validation errors:

Session Data (accessible via responsable()):

Example 6: Persistent Session Data

Use $persist = true to store data beyond the next request:

Helper Functions

responsable()

Retrieve session data stored by web macros in a structured array:

Example in a Controller:

responsable_forget()

Clear session data stored by web macros:

Example in a Controller:

Accessing Session Data in Views

Use the responsable() helper in Blade views for a cleaner interface:

Alternatively, access session data directly:

Macro Signatures

You can also use the response() helper for JSON responses:

IDE Support

To enable autocompletion for the success, error, responsable(), and responsable_forget() functions in your IDE ( e.g., PHPStorm, VS Code):

  1. Install the barryvdh/laravel-ide-helper package:

  2. Generate the IDE helper file:

This creates a _ide_helper.php file that includes the success and error macros for both Response and RedirectResponse, as well as the responsable() and responsable_forget() helpers.

License

This package is open-sourced under the MIT License.


All versions of responsable with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
illuminate/support Version ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/http Version ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0|^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ysm/responsable contains the following files

Loading the files please wait ...