Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mnsami/content-api
https://github.com/mnsami/content-api
anti-corruption-layer ddd docker php rest-api restapi symfony
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/mnsami/content-api
- Owner: mnsami
- License: mit
- Created: 2019-06-19T18:22:39.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-04-19T19:35:29.000Z (over 1 year ago)
- Last Synced: 2024-05-01T21:54:34.917Z (8 months ago)
- Topics: anti-corruption-layer, ddd, docker, php, rest-api, restapi, symfony
- Language: PHP
- Size: 270 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Content API
This API is an exercise to apply anti-corruption pattern along with practicing DDD.
### 1. Frameworks and bundles used
1. `Symfony: 3.4`
2. For caching, memcached is used.
3. Nginx
4. php-fpm
#### 1.1. ArchitectureMemcached is used to cache responses using the request information as cache key.
Caching keys are being cached for 1 day only.I used the default Symfony Memcached adapter.
https://symfony.com/doc/3.4/components/cache/adapters/memcached_adapter.htmlCache keys are generated like using this formula `sourceId_year_limit`, from the request.
### 2. Installations1. Setup project and containers:
1.1 checkout the project
git clone [email protected]:mnsami/content-api.git
cd content-api
1.2. copy `parameters.yml`
make
1.3. Start the containers and install dependenciesmake all
### 3. API Available routes
To make api request use `http://localhost/v1/` as base url.
i.e. `http://localhost/v1/items`| Name| Method| Scheme| Host| Path|
|--------------------|--------|--------|------|---------------------|
| get_items| GET| ANY| ANY| /v1/items|
| alive| GET| ANY| ANY| /v1/_healthCheck|#### 3.1 Api Documentation
#### 3.1.1`GET /v1/items`
- **Description:** Get items.
- **method**: `GET`
- **Response**: Items list. Request meta information.
- **Url Params**:
- **sourceId:** Data source, **type:** string, **required:** true
- **year:** year, **type:** integer, **required:** false
- **limit:** limit, **type:** integer, **required:** false### 4. Helper Make commands
I like to use `make` for my projects, hence below are some helper `make` commands
- `make all`: Start up the container services and install project dependencies.
- `make composer`: Install composer dependencies.
- `make cc`: Remove symfony caches.
- `make clear`: Delete vendor. cache, logs and library binaries.
- `make lint`: Lint all php, yml, json and composer.
- `make phpcs`: Run code sniffer to check styles.
- `make phpcbf`: fix styles.
- `make tests`: Run tests
- `make coverage`: Generate coverage report
- `make tear-down`: Stop all containers and down.
- `make container-up`: Start all container services
- `make container-stop`: Stop all containers services.
- `make container-down`: down all containers.