https://github.com/polidog/simpleapibundle
https://github.com/polidog/simpleapibundle
library php-library symfony-bundle
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/polidog/simpleapibundle
- Owner: polidog
- License: mit
- Created: 2018-09-11T03:49:36.000Z (almost 8 years ago)
- Default Branch: 1.0
- Last Pushed: 2023-09-02T12:34:37.000Z (almost 3 years ago)
- Last Synced: 2025-03-18T19:54:36.502Z (over 1 year ago)
- Topics: library, php-library, symfony-bundle
- Language: PHP
- Size: 64.5 KB
- Stars: 1
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PolidogSimpleApiBundle
## Installation
```
$ composer require polidog/simple-api-bundle "dev-master"
```
Add config/bundles.php
```php
['all' => true]
];
```
## Introduce bundle configuration to your config file
```yaml
# config/packages/polidog_simple_api.yml
polidog_simple_api: ~
```
## Usage
```php
userRepository->find($id);
return [
'id' => $user->getId(),
'name' => $user->getUsername(),
'avatar' => $user->getAvatar(),
];
}
/**
* for php7
* @Route("/user/post", methods={"POST"})
* @Api(statusCode=201)
*/
#[Route('/user/post', name: 'POST')]
#[Api(201)]
public function post(Request $request): array
{
// TODO save logic.
return [
'status' => 'ok',
];
}
}
```