kzorluoglu / rest-api-bundle
A Symfony bundle for Chameleon System
Installs: 5
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^7.4
- ext-json: *
- ext-pdo: *
- chameleon-system/chameleon-base: 7.1.x@dev
- zircote/swagger-php: ^3.1
Requires (Dev)
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2025-02-25 21:15:31 UTC
README
This bundle provide REST API interface for Chameleon Shop. All Business-Features (not yet) be possible.
Actually Completed Features:
- Login
- Basic Product List with sorting, offset and limit
installation
- Install the Bundle via Composer
composer.sh require kzorluoglu/rest-api-bundle:dev-master
- Add the Bundle in app/AppKernel.php
new \kzorluoglu\RestApiBundle\kzorluogluRestApiBundle(),
- Add the AnnotationReader::addGlobalIgnoredNamespace("OA") in app/autoload.php
$loader = require __DIR__.'/../vendor/autoload.php';
// OA (open AI) Annotations adding Doctorine Ingored Namespaces List
\Doctrine\Common\Annotations\AnnotationReader::addGlobalIgnoredNamespace("OA");
- Add the API Route in app/config/routing.yml
api:
resource: "@kzorluogluRestApiBundle/Resources/config/routing.yml"
type: yaml
prefix: /api
Documentation for API Endpoints
All URIs are relative to https://demo.chameleon-system.de/
Class | Method | HTTP request | Description |
---|---|---|---|
DefaultApi | kzorluogluRestApiBundleControllerLoginControllerLogin | POST /api/login | Login as user |
DefaultApi | kzorluogluRestApiBundleControllerProductProductControllerIndex | POST /api/product | Product List |
Documentation For Models
Tests
Prepare
cd /vendor/kzorluoglu/rest-api-bundle
composer install
and Run Tests
./vendor/bin/phpunit -c phpunit.xml
Development
Create a new openapi yaml after changes
./vendor/bin/openapi -o api.yml /your/root/path/vendor/kzorluoglu/rest-api-bundle/Controller
Example:
./vendor/bin/openapi -o api.yml /usr/local/apache2/htdocs/customer/vendor/kzorluoglu/rest-api-bundle/Controller
- Check if api.yml exists
../customer
..../app
..../web
..../api.yml
- For Preview; copy the contents of the api.yml file and paste it on https://editor.swagger.io
Documentation generating
Preview
- copy the contents of the api.yml file
- paste it on https://editor.swagger.io
Alternative 1
- Copy the contents of the api.yml file and paste it on https://editor.swagger.io
- Click Generate Client
- Choose one of the Client Software Language
- extract the generated zip file
- copy the "## Documentation for API Endpoints" Section from readme.md in your readme.md
- copy the docs folder from zip to this bundle
Alternative 2
- Download https://github.com/swagger-api/swagger-ui - folder of interest is "dist"
- Copy your api YAML into the dist folder
- Open index.html and change the value of URL inside the tag at the bottom of the file to ./swagger.json (or whatever your swagger json is called)
- Host online! (or start a local server to view output).