https://github.com/tudor-rusu/wando-service
Building a small service with highlight Oriented Object Programming concepts
https://github.com/tudor-rusu/wando-service
composer docker nginx oop-principles php72 phpunit service
Last synced: 8 months ago
JSON representation
Building a small service with highlight Oriented Object Programming concepts
- Host: GitHub
- URL: https://github.com/tudor-rusu/wando-service
- Owner: tudor-rusu
- License: mit
- Created: 2020-05-24T11:04:03.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-05-29T15:03:53.000Z (over 5 years ago)
- Last Synced: 2025-01-19T18:44:01.616Z (9 months ago)
- Topics: composer, docker, nginx, oop-principles, php72, phpunit, service
- Language: PHP
- Homepage: https://compado.rusu.tech/
- Size: 51.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
Wando Service
======================================
[![Conventional Commits][conventional-commits-image]][conventional-commits-url]
The scope of the project is about to highlight Oriented Object Programming concepts and S.O.L.I.D principles by
building a small service.
## About the project
#### Project stack
* PHP 7.2
* nginx alpine
* Composer
* Phpunit
#### Design patterns
* Singleton
* Front Controller
* Model Controller
* Fluent Interface
* Dependency Injection
* Strategy
* Delegation
#### Overview and Project requirements
Wando runs an internet site for product search and price comparison. It helps users to find the best deals for a
particular item, by searching through different product feeds from various providers (e.g. ebay, amazon, etc.).
Managing an almost infinite number of products has a lot of challenges, in this exercise we will focus only on
the backend side and create a small service, which connects the ebay product feed and provides an interface to get product data.
## Production demo and usage
Wando Service is available to test (for a short period of time) from [Production site][5]
### Usage
* Request method is GET
* accepted parameters:
* **feed** - if this is not provided, the App will take all API Feeds listed in /config/feeds.json
* **keywords** - this is required, here add searching keyword(s), usually separated by space (e.g. "iphone apple macbook")
* **price_min** - part of the filtering, optional
* **price_max** - part of the filtering, optional
* **sorting** - optional, use API Feeds in order to provide a better sorting method
* **page_number** - this parameter, part of pagination, set the page for return
* **items_per_page** - this parameter, part of pagination, it is important in case of big data collection
* return:
* the application return in any cases a JSON object, with: resolution (success or error), message (description of
results) and data (data collection)
* in case of success, data collection will have two elements:
```json
"data": {
"paginationOutput": {
"pageNumber": "1",
"entriesPerPage": "5",
"totalPages": "12",
"totalEntries": "56"
},
"data": [
{
"provider": "",
"merchant_id": null,
"merchant_logo_url": "",
"item_id": ""
....
```
## Install and run on local machine
### Prerequisites
Before start install, user will need:
* One [Bionic Beaver][1], and a non-root user with `sudo` privileges.
* [Composer][2]
* [Docker][3]
* [Docker Compose][4]
### Install local and run
* Clone repository
```shell script
git clone https://github.com/tudor-rusu/wando-service.git ${PROJECT_ROOT}
```
* Copy and adjust environmental settings in the root of the project, assumed `${PROJECT_ROOT}/src`:
```shell script
cd ${PROJECT_ROOT}/src
cp .env.dist .env
```
* Run the `sh` script which deploy Docker environment
```shell script
./run.sh
```
* Enjoy!
[conventional-commits-image]: https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg
[conventional-commits-url]: https://conventionalcommits.org/
[1]: http://releases.ubuntu.com/18.04.4/
[2]: https://www.digitalocean.com/community/tutorials/how-to-install-and-use-composer-on-ubuntu-18-04
[3]: https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-18-04
[4]: https://www.digitalocean.com/community/tutorials/how-to-install-docker-compose-on-ubuntu-18-04
[5]: https://compado.rusu.tech/