Download the PHP package sajadsdi/laravel-rest-response without Composer

On this page you can find all versions of the php package sajadsdi/laravel-rest-response. 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 laravel-rest-response

Laravel REST Response

Laravel REST Response

a PHP package that simplifies the generation of clean and consistent responses for RESTful APIs in Laravel applications.

Features

Installation

You can install this library using Composer. If you haven't already set up Composer for your project, you can do so by following the official Composer installation guide.

Once Composer is installed, run the following command to install Laravel REST Response:

Usage

It is recommended to extend the RestController class in your base controller, to allowing all controllers that inherit from it to have access to the RESTful methods. This approach provides a convenient way to handle API responses consistently across your application.

Extending in Base Controller

In the Laravel application, there is a base controller by default, which you can find at the address below.

open Controller.php or your custom base controller.

you need change the BaseController to RestController like below.

Using Rest methods in Controllers

now you can use Rest methods in your controllers like below.

Customizing api version

you can customize api version in your controller or base controller like below.

you can also customize api version in any controller by defining getVersion method.

Implement BaseRequest

extends BaseRequest for all request classes to integrate all response with package response.

Use CRUD methods and repository

ensure that your repository class implements the CrudRepositoryInterface. This interface must define the methods for create, read, update, delete, and index. Here’s an example of how your repository should look:

Integrate into a Controller

After setting up your repository, you can use the CrudApi trait in any controller to manage your resources.

Example:

The CrudApi trait provides you with the following methods:

Each operation will automatically handle successful responses and failures (e.g., bad requests or not found errors).

Json Response

all responses are in json format, and they have the same data structure like below.

Contributing

We welcome contributions from the community to improve and extend this library. If you'd like to contribute, please follow these steps:

  1. Fork the repository on GitHub.
  2. Clone your fork locally.
  3. Create a new branch for your feature or bug fix.
  4. Make your changes and commit them with clear, concise commit messages.
  5. Push your changes to your fork on GitHub.
  6. Submit a pull request to the main repository.

Reporting Bugs and Security Issues

If you discover any security vulnerabilities or bugs in this project, please let us know through the following channels:

Contact

If you have any questions, suggestions, financial, or if you'd like to contribute to this project, please feel free to contact the maintainer:

We appreciate your feedback, support, and any financial contributions that help us maintain and improve this project.

License

This library is open-source software licensed under the MIT License.


All versions of laravel-rest-response with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
illuminate/console Version ^8.0|^9.0|^10.0|^11.0
illuminate/support Version ^8.0|^9.0|^10.0|^11.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 sajadsdi/laravel-rest-response contains the following files

Loading the files please wait ....