Download the PHP package abdulbaset/response-format-trait without Composer

On this page you can find all versions of the php package abdulbaset/response-format-trait. 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 response-format-trait

Documentation

Response-Format-Trait

This PHP package provides a simple and consistent way to format API and web responses. It includes a set of predefined HTTP status codes with detailed messages and supports both API and web response formatting. The package is designed to be easy to integrate into any PHP Laravel project, with a particular focus on Laravel applications.

Features

Installation

Use Composer to install the package:

You can install this package via Composer:

To update the abdulbaset/response-format-trait package in your Laravel project, you can use Composer's update command. Here's how you can do it:

After running the update command in your Laravel project directory, and Composer will check for updates to the abdulbaset/response-format-trait package and its dependencies. If a newer version is available, Composer will download and install it, updating your project.

Usage

  1. Publishing Configuration File You can publish the configuration file or language files using the following command:

This command will copy the response-format.php file to your config directory, allowing you to customize the package's behavior.

  1. Generating Responses

This method validates whether a given language code is supported within the Respond trait. It checks if the provided language code exists within the predefined list of supported languages. If the language code is found in the list, the method returns true, indicating that the language is supported. Otherwise, it returns false.

Examples

Here are some examples of how you can use the Respond trait in your controllers:

  1. here you can customize message and details response as you need. and you will get the response like:
  2. here you can change the default language to get message and details for some specific local as you need. and you will get the response like: other example for 404 not found error and you will get the response like:
  3. if you want set the dynamically local language you can make middleware and set inside config(['response-format.language' => config('app.local', 'en')]); and you will get the response like:
  4. if you want check the package is supported the language or not, you can use this Respond::isLanguageSupported($language) static method.

Configuration

You can customize the behavior of the package by modifying the response-format.php configuration file. The available options are:

Supported languages:

If set to null, the language will be determined dynamically.

Author

The package was created by Abdulbaset R. Sayed [email protected]

Contributing

Contributions are welcome! If you encounter any issues or have suggestions for improvements, feel free to open an issue or submit a pull request on GitHub.

License

This Package is licensed under the MIT License - see the LICENSE file for details.


All versions of response-format-trait with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
illuminate/support Version ^8.0|^9.0|^10.0
illuminate/http Version ^8.0|^9.0|^10.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 abdulbaset/response-format-trait contains the following files

Loading the files please wait ....