{"id":14974410,"url":"https://github.com/jainsiddharth21/orderapi","last_synced_at":"2026-03-04T01:17:30.547Z","repository":{"id":37528819,"uuid":"211824682","full_name":"jainsiddharth21/OrderAPI","owner":"jainsiddharth21","description":"Rest API to Create, Fetch and Take orders.","archived":false,"fork":false,"pushed_at":"2023-02-02T07:46:49.000Z","size":2600,"stargazers_count":0,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-27T03:14:47.903Z","etag":null,"topics":["api","docker","docker-compose","laravel","laravel5","order-management","rest-api","swagger","swagger-ui"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jainsiddharth21.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-30T09:31:14.000Z","updated_at":"2020-08-03T06:38:21.000Z","dependencies_parsed_at":"2024-10-11T10:41:39.271Z","dependency_job_id":"531aa390-d1a0-45cf-8af5-69946dd072c5","html_url":"https://github.com/jainsiddharth21/OrderAPI","commit_stats":{"total_commits":1,"total_committers":1,"mean_commits":1.0,"dds":0.0,"last_synced_commit":"a4216891aa87fd51d04627c1f9252ecef547b4fc"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jainsiddharth21%2FOrderAPI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jainsiddharth21%2FOrderAPI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jainsiddharth21%2FOrderAPI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jainsiddharth21%2FOrderAPI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jainsiddharth21","download_url":"https://codeload.github.com/jainsiddharth21/OrderAPI/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240970218,"owners_count":19886526,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","docker","docker-compose","laravel","laravel5","order-management","rest-api","swagger","swagger-ui"],"created_at":"2024-09-24T13:50:31.270Z","updated_at":"2026-03-04T01:17:30.516Z","avatar_url":"https://github.com/jainsiddharth21.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"#  Rest API for OrderAPI\nAPI to Create, Fetch and Take orders.\n\n## Docker, language, Framework, Database and server requirement\n\n- [Docker](https://www.docker.com/) as the container service to isolate the environment.\n- [Php](https://php.net/) to develop backend support.\n- [Laravel](https://laravel.com) as the server framework / controller layer\n- [MySQL](https://mysql.com/) as the database layer\n- [NGINX](https://docs.nginx.com/nginx/admin-guide/content-cache/content-caching/) as a proxy / content-caching layer\n\n## Installation steps to run the APP\n\n1.  Clone the repo.\n2. `src` folder contains the complete application code.\n3.  As we have used the Google distance matrix api to calculate distance from the Co-ordinates, you need API key for the same. \n    Go to https://cloud.google.com/maps-platform/routes/ after login create new project and get the API key. \n    update 'GOOGLE_API_KEY' in environment file located in ./src/.env file\n4.  Within the root folder you will find \"start.sh\" file. Run `./start.sh` to build docker containers, executing migration and PHPunit Unit \u0026 Feature test cases\n5.  After starting container following will be executed automatically:\n  - Composer will install all dependencies required to run the code.\n  - Config and Application Cache will be cleared.\n\t- Table migrations using artisan migrate command.\n\t- Unit and Feature Integration test cases execution.\n\n## For Migrating tables and Data Seeding\n\n1. For running migrations manually `docker exec orderapi_php php artisan migrate`\n\n## For manually running the docker and test Cases\n\n1. You can run `docker-compose up` from terminal\n2. Server is accessible at `http://localhost:8080`\n3. To run the Feature test cases only:  `docker exec orderapi_php php ./vendor/phpunit/phpunit/phpunit ./tests/Feature`\n4. To run the Unit test cases only:  `docker exec orderapi_php php ./vendor/phpunit/phpunit/phpunit ./tests/Unit`\n5. Run both Feature Integration \u0026 Unit test case suite: `docker exec orderapi_php php ./vendor/phpunit/phpunit/phpunit`\n\n## Swagger integration\n\n1. Open URL for API demo `http://localhost:8080/api-documentation`\n2. Here you can perform all API operations like GET, UPDATE, POST\n\n## Code Structure\nsrc folder contain application code.\n\n**./tests**\n\n- this folder contains both Feature and Unit test cases files.\n\n**./app**\n\n- Folder contains all the framework configuration file, controllers and models\n- Migration files are present inside the database/migrations/ folder\n\t- To run manually migrations use this command `docker exec orderapi_php php artisan migrate`\n- `OrderController` contains all the api's methods :\n    1. localhost:8080/orders?page=1\u0026limit=4 - GET url to fetch orders with page and limit\n    2. localhost:8080/orders - POST method to insert new order with origin and distination\n    3. localhost:8080/orders - PATCH method to update status for taken. (handled the concurrent request for taking the order. If order already taken then other request will get response status 409)\n- `DistanceService` contains the logic to calculate distance from Co-ordinates.\n\n**.env**\n\n- env file contain all project configuration, you can configure database, session and custom configuration. We have set the GOOGLE_API_URL, GOOGLE_API_KEY and GOOGLE_API_UNIT in the env file so that it is configurable.\n\n## API Reference Documentation\n-  Find below API documentation for the help.\n- `localhost:8080/orders?page=:page\u0026limit=:limit` :\n\n    GET Method - to fetch orders with page number and limit\n    1. Header :\n        - GET /orders?page=2\u0026limit=3\n        - Host: localhost:8080\n        - Content-Type: application/json\n\n    2. Responses :\n\n    ```\n            - Response\n            [\n              {\n                \"id\": 4,\n                \"distance\": 854523,\n                \"status\": \"TAKEN\"\n              },\n              {\n                \"id\": 5,\n                \"distance\": 147959,\n                \"status\": \"UNASSIGNED\"\n              },\n              {\n                \"id\": 6,\n                \"distance\": 19285,\n                \"status\": \"TAKEN\"\n              }\n            ]\n    ```\n\n        Code                    Description\n        - 200                   Successful Operation\n        - 400                   Request Denied\n        - 406                   Invalid Request Parameter\n\n- `localhost:8080/orders` :\n\n    POST Method - to create new order with origin and distination\n    1. Header :\n        - POST /orders\n        - Host: localhost:8080\n        - Content-Type: application/json\n\n    2. Post-Data :\n    ```\n         {\n            \"origin\": [\"-33.865143\",\"151.209900\"],\n            \"destination\": [\"-37.663712\",\"144.844788\"]\n         }\n    ```\n\n    3. Responses :\n    ```\n            - Response\n            {\n              \"id\": 1,\n              \"distance\": 854523,\n              \"status\": \"UNASSIGNED\"\n            }\n    ```\n\n        Code                    Description\n        - 200                   Successful Operation\n        - 400                   Request Denied\n        - 406                   Invalid Input\n\n- `localhost:8080/orders/:id` :\n\n    PATCH method to update status for orders already taken. (Handled simultaneous update request from multiple users at the same time with response status 409)\n    1. Header :\n        - PATCH /orders/3\n        - Host: localhost:8080\n        - Content-Type: application/json\n\n    2. Post-Data :\n    ```\n         {\n            \"status\" : \"TAKEN\"\n         }\n    ```\n\n    3. Responses :\n    ```\n            - Response\n            {\n              \"status\": \"SUCCESS\"\n            }\n    ```\n    or\n    ```\n            - Response\n            {\n              \"status\": \"ORDER_ALREADY_TAKEN\"\n            }\n    ```\n\n        Code                    Description\n        - 200                   successful operation\n        - 400                   Invalid Request Parameter\n        - 404                   Invalid Order Id\n        - 409                   Order already taken\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjainsiddharth21%2Forderapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjainsiddharth21%2Forderapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjainsiddharth21%2Forderapi/lists"}