PHPackages                             tims3l/restapi-bundle - 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. [API Development](/categories/api)
4. /
5. tims3l/restapi-bundle

ActiveSymfony-bundle[API Development](/categories/api)

tims3l/restapi-bundle
=====================

tims3l restapi api symfony bundle

09PHP

Since Oct 28Pushed 3y ago1 watchersCompare

[ Source](https://github.com/tims3l/restapi-bundle)[ Packagist](https://packagist.org/packages/tims3l/restapi-bundle)[ RSS](/packages/tims3l-restapi-bundle/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

restapi-bundle
==============

[](#restapi-bundle)

Restapi bundle is a `Symfony` / `Doctrine` based `REST API` library, written in `PHP 8`.

Requirements
------------

[](#requirements)

- `php 8.1`
- `composer`
- `symfony 6.1`

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

[](#installation)

```
composer require tims3l/restapi-bundle:dev-develop
cp vendor/tims3l/restapi-bundle/config/packages/tims3l_restapi.yaml config/packages/tims3l_restapi.yaml
bin/console cache:clear
```

Usage
-----

[](#usage)

You can quickly create `HTTP` endpoints, based on `REST` principles. The `RestApi` class is responsible for the standard `CRUD` operation through `HTTP` endpoints.

- Create a Doctrine entity in `App\Entity` namespace.
    - It is important to use the `#[Api]` attribute on your entity.
    - You can see a demo `Product` entity [here](https://github.com/tims3l/restapi-demo/blob/develop/src/Entity/Product.php).
- Extend `Tims3l\Repository\AbstractRepostory` in `App\Repository` namespace.
    - You can use [this](https://github.com/tims3l/restapi-demo/blob/develop/src/Repository/ProductRepository.php) `ProductRepository` class as an example.
- **And that's it, you can use the standard `CRUD` endpoints (`POST`, `PUT`, `GET`, `DELETE`) on your new entity.** The underlying logic makes sure that all of your endpoints will respond with the same `JSON` format, and can be called in the same way.

### Sample `REST API` with a `product` entity

[](#sample-rest-api-with-a-product-entity)

#### Insert product

[](#insert-product)

- `POST` `/product`
    - Header
        - `Content-Type: application/x-www-form-urlencoded`
    - Data
        - `sku: sku-1`
        - `name: one`
        - `description: desc-one`
        - `price: 1000`
- Sample response (HTTP Status code: `201 Created`)

```
{
	"success": true,
	"data": [
		{
			"id": 1,
			"name": "one",
			"sku": "sku-one",
			"description": "desc-one",
			"price": 1000
		}
	],
	"errors": []
}
```

#### List products

[](#list-products)

- `GET` `/product`
- Sample response (HTTP Status code: `200 OK`)

```
{
	"success": true,
	"data": [
		{
			"id": 1,
			"name": "one",
			"sku": "sku-one",
			"description": "desc-one",
			"price": 1000
		},
		{
			"id": 2,
			"name": "two",
			"sku": "sku-two",
			"description": "desc-two",
			"price": 2000
		}
	],
	"errors": []
}
```

#### Show one product

[](#show-one-product)

- `GET` `/product/{id}`
- Sample response (HTTP Status code: `200 OK`)

```
{
	"success": true,
	"data": [
		{
			"id": 1,
			"name": "one",
			"sku": "sku-one",
			"description": "desc-one",
			"price": 1000
		}
	],
	"errors": []
}
```

#### Modify product

[](#modify-product)

- `PUT` `/product/{id}`
    - Header
        - `Content-Type: application/x-www-form-urlencoded`
    - Data
        - `description: modified-desc`
- Sample response (HTTP Status code: `200 OK`)

```
{
	"success": true,
	"data": [
		{
			"id": 1,
			"name": "one",
			"sku": "sku-one",
			"description": "modified-desc",
			"price": 1000
		}
	],
	"errors": []
}
```

#### Remove product

[](#remove-product)

- `DELETE` `/product/{id}`
    - Header
        - `Content-Type: application/x-www-form-urlencoded`
    - Data
        - `description: modified-desc`
- Response is always empty (HTTP Status code: `204 No Content`)

Tests
-----

[](#tests)

### Unit

[](#unit)

These tests ensure that individual units of source code (e.g. a single class) behave as intended.

You can run unit tests with the following command:

`vendor/bin/phpunit tests/Unit`

### Application

[](#application)

Application tests test the behavior of a complete application. They make HTTP requests (both real and simulated ones) and test that the response is as expected.

You can quickly test your new endpoints using the `AbstractApiTest` class.

- Simply extend a new final class from the `AbstractApiTest` class.
- Customize the `testPostProvider()` methods based on your needs.
- Simply run the new test with the following command:
    - `vendor/bin/phpunit tests/Application`

**Note: HTTP server must be running to process application tests.**

RestApi Demo
------------

[](#restapi-demo)

See

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity24

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/b0925639288a9ea55be17bfce655860b94084d914c9af3325213eee98d4a80d0?d=identicon)[tims3l](/maintainers/tims3l)

---

Top Contributors

[![tims3l](https://avatars.githubusercontent.com/u/115475602?v=4)](https://github.com/tims3l "tims3l (3 commits)")

### Embed Badge

![Health badge](/badges/tims3l-restapi-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/tims3l-restapi-bundle/health.svg)](https://phpackages.com/packages/tims3l-restapi-bundle)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[facebook/php-business-sdk

PHP SDK for Facebook Business

90821.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

74513.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

265103.1M454](/packages/google-gax)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
