PHPackages                             nextphp/rest - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. nextphp/rest

ActiveLibrary[Framework](/categories/framework)

nextphp/rest
============

The NextPHP Rest package provides powerful routing capabilities and HTTP handling for PHP developers. This package supports all RESTful methods (GET, POST, PUT, DELETE, PATCH, OPTIONS, HEAD, TRACE, CONNECT, PRI) and various response formats such as JSON, XML, HTML, TEXT, and CSV. It is part of the NextPHP Framework, a modern and lightweight PHP framework designed for performance and scalability.

1.2.0(1y ago)0201MITPHPPHP ^8.1

Since Jul 4Pushed 1y ago1 watchersCompare

[ Source](https://github.com/nextphp-projects/rest)[ Packagist](https://packagist.org/packages/nextphp/rest)[ Docs](https://nextphp.io)[ RSS](/packages/nextphp-rest/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)DependenciesVersions (3)Used By (1)

NextPHP Rest Package
====================

[](#nextphp-rest-package)

The [NextPHP Rest](https://packagist.org/packages/nextphp/rest) package provides powerful routing capabilities and HTTP handling for PHP developers. This package supports all RESTful methods (GET, POST, PUT, DELETE, PATCH, OPTIONS, HEAD, TRACE, CONNECT, PRI) and various response formats such as JSON, XML, HTML, TEXT, and CSV. It simplifies the creation of APIs by allowing developers to define routes and controllers using attributes, ensuring a clean and efficient codebase.

This package is part of the [NextPHP Framework](https://github.com/nextphp-projects/nextphp), a modern and lightweight PHP framework designed for performance and scalability. [NextPHP](https://nextphp.io) aims to provide a comprehensive suite of tools and libraries to streamline the development process.

Features
--------

[](#features)

- Support for all RESTful methods (GET, POST, PUT, DELETE, PATCH, OPTIONS, HEAD, TRACE, CONNECT, PRI)
- Response formats: JSON, XML, HTML, TEXT, CSV
- Attribute-based route definitions
- Middleware support
- Easy integration with existing projects

Installation
------------

[](#installation)

### Installing via Composer

[](#installing-via-composer)

To install the NextPHP Rest package, you need to add it to your project using Composer.

```
composer require nextphp/rest
```

Example Project using NextPHP Rest
==================================

[](#example-project-using-nextphp-rest)

This is an example project demonstrating the usage of the NextPHP Rest package, which includes routing and HTTP handling capabilities.

Basic Usage Defining Routes Define routes using attributes to map HTTP methods to controller actions.

Usage
-----

[](#usage)

### Using Controller

[](#using-controller)

```
