{"id":15014163,"url":"https://github.com/rafal-kucharski/rest-api","last_synced_at":"2025-04-09T19:23:08.759Z","repository":{"id":37506590,"uuid":"201084600","full_name":"rafal-kucharski/rest-api","owner":"rafal-kucharski","description":"Laravel restfull api boilerplate","archived":false,"fork":false,"pushed_at":"2023-01-04T07:24:23.000Z","size":1469,"stargazers_count":65,"open_issues_count":25,"forks_count":30,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-23T21:22:00.794Z","etag":null,"topics":["api","api-rest","boilerplate","docker","json-api","laravel","laravel-framework","laravel-passport","laravel58","php","postman","restfull-api"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rafal-kucharski.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-07T16:10:25.000Z","updated_at":"2024-12-07T17:04:27.000Z","dependencies_parsed_at":"2023-02-02T03:16:40.087Z","dependency_job_id":null,"html_url":"https://github.com/rafal-kucharski/rest-api","commit_stats":null,"previous_names":["rafal-kucharski/rest-api","nicp0nim/rest-api"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rafal-kucharski%2Frest-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rafal-kucharski%2Frest-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rafal-kucharski%2Frest-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rafal-kucharski%2Frest-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rafal-kucharski","download_url":"https://codeload.github.com/rafal-kucharski/rest-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248095822,"owners_count":21046916,"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","api-rest","boilerplate","docker","json-api","laravel","laravel-framework","laravel-passport","laravel58","php","postman","restfull-api"],"created_at":"2024-09-24T19:45:16.727Z","updated_at":"2025-04-09T19:23:08.739Z","avatar_url":"https://github.com/rafal-kucharski.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RestAPI - Based on Laravel with Docker\n[![Build Status](https://travis-ci.com/nicp0nim/rest-api.svg?branch=master)](https://travis-ci.com/nicp0nim/rest-api)\n![Release](https://img.shields.io/github/release/nicp0nim/rest-api)\n![Code Size](https://img.shields.io/github/languages/code-size/nicp0nim/rest-api)\n![Last commit](https://img.shields.io/github/last-commit/nicp0nim/rest-api)\n[![License](https://img.shields.io/github/license/nicp0nim/rest-api)](https://github.com/nicp0nim/rest-api/blob/master/LICENSE)\n\nLaravel 6.0 Restful API boiler plate with:\n\u003csmall\u003e\n - auth;\n - roles;\n - permissions; \n - crud;\n - json responses;\n - phpunit and travis tests;\n - database seeder with factories;\n \u003c/small\u003e\n\n## Requirements\n\nAs it is build on the Laravel framework, it has a few system requirements.\u003cbr\u003e\nOf course, all of these requirements are satisfied by the Docker, so it's highly recommended that you use Docker as\n your local Laravel development environment.\n \nHowever, if you are not using Docker, you will need to make sure your server meets the following requirements:\n- PHP \u003e= 7.1.3\n- MySql \u003e= 5.7\n- Composer\n- OpenSSL PHP Extension\n- PDO PHP Extension\n- Mbstring PHP Extension\n- Tokenizer PHP Extension\n- XML PHP Extension\n- Ctype PHP Extension\n- JSON PHP Extension\n- BCMath PHP Extension\n\nYou can check all the laravel related dependecies [here](https://laravel.com/docs/5.7/installation#server-requirements).\n\n## Install application.\n\n1. Clone repository and setup.\u003cbr\u003e\n`git clone git@github.com:nicp0nim/rest-api.git`\u003cbr\u003e\n`cd rest-api`\u003cbr\u003e\n`cp .env.example .env`\u003cbr\u003e\n2. Start docker.\u003cbr\u003e\n`docker-compose up -d`\n3. Install needed packages.\u003cbr\u003e\n`docker exec php-fpm composer install`\u003cbr\u003e\n4. Migrate, install passport and seed database with fake data.\u003cbr\u003e\n`docker exec php-fpm php artisan key:generate`\u003cbr\u003e\n`docker exec php-fpm php artisan migrate:fresh --seed`\u003cbr\u003e\n`docker exec php-fpm php artisan passport:install`\u003cbr\u003e\n\n\n\u003csmall\u003eThis way is to setup app with docker, but if you want use it without docker just skip second step and replace\n from commands `docker exec php-fpm` part. For example 3 step without Docker should look like:\u003cbr\u003e\n `composer install`\u003c/small\u003e\n\u003cbr\u003e\n\n## API Endpoints and Routes\nLaravel follows the Model View Controller (MVC) pattern I have creatd models associated with each resource. You can check in the **routes/api.php** file for all the routes that map to controllers in order to send out JSON data that make requests to our API.\n\n```\n+-----------+----------------------------+-----------------+--------------------------------------------------+--------------+\n| Method    | URI                        | Name            | Action                                           | Middleware   |\n+-----------+----------------------------+-----------------+--------------------------------------------------+--------------+\n| GET|HEAD  | /                          |                 | Closure                                          | web          |\n+-----------+----------------------------+-----------------+--------------------------------------------------+--------------+\n| GET|HEAD  | api/clients                | clients.index   | App\\Http\\Controllers\\ClientController@index      | api,auth:api |\n| POST      | api/clients                | clients.store   | App\\Http\\Controllers\\ClientController@store      | api,auth:api |\n| DELETE    | api/clients/{client}       | clients.destroy | App\\Http\\Controllers\\ClientController@destroy    | api,auth:api |\n| PUT|PATCH | api/clients/{client}       | clients.update  | App\\Http\\Controllers\\ClientController@update     | api,auth:api |\n| GET|HEAD  | api/clients/{client}       | clients.show    | App\\Http\\Controllers\\ClientController@show       | api,auth:api |\n+-----------+----------------------------+-----------------+--------------------------------------------------+--------------+\n| GET|HEAD  | api/roles                  | roles.index     | App\\Http\\Controllers\\RoleController@index        | api,auth:api |\n| POST      | api/roles                  | roles.store     | App\\Http\\Controllers\\RoleController@store        | api,auth:api |\n| DELETE    | api/roles/{client}         | roles.destroy   | App\\Http\\Controllers\\RoleController@destroy      | api,auth:api |\n| PUT|PATCH | api/roles/{client}         | roles.update    | App\\Http\\Controllers\\RoleController@update       | api,auth:api |\n| GET|HEAD  | api/roles/{client}         | roles.show      | App\\Http\\Controllers\\RoleController@show         | api,auth:api |\n+-----------+----------------------------+-----------------+--------------------------------------------------+--------------+\n| GET|HEAD  | api/users                  | users.index     | App\\Http\\Controllers\\UserController@index        | api,auth:api |\n| POST      | api/users                  | users.store     | App\\Http\\Controllers\\UserController@store        | api,auth:api |\n| DELETE    | api/users/{client}         | users.destroy   | App\\Http\\Controllers\\UserController@destroy      | api,auth:api |\n| PUT|PATCH | api/users/{client}         | users.update    | App\\Http\\Controllers\\UserController@update       | api,auth:api |\n| GET|HEAD  | api/users/{client}         | users.show      | App\\Http\\Controllers\\UserController@show         | api,auth:api |\n+-----------+----------------------------+-----------------+--------------------------------------------------+--------------+\n| POST      | api/login                  | auth.login      | App\\Http\\Controllers\\AuthController@login        | api          |\n| GET|HEAD  | api/logout                 | auth.logout     | App\\Http\\Controllers\\AuthController@logout       | api,auth:api |\n| GET|HEAD  | api/profile                | auth.profile    | App\\Http\\Controllers\\AuthController@profile      | api,auth:api |\n| POST      | api/register               | auth.register   | App\\Http\\Controllers\\AuthController@register     | api          |\n+-----------+----------------------------+-----------------+--------------------------------------------------+--------------+\n```\n\n## API Docs\n\nYou can find full postman documentation with example success and error requests [here](https://documenter.getpostman.com/view/1946566/S11BzNAn?version=latest).\n\n#### Example login request\n\n```bash\ncurl --location --request POST \"http://localhost:8080/api/login\" \\\n  --header \"Content-Type: application/json\" \\\n  --header \"X-Requested-With: XMLHttpRequest\" \\\n  --data \"{\n\t\\\"email\\\": \\\"admin@mail.com\\\",\n\t\\\"password\\\": \\\"pass\\\"\n}\"\n```\n\n#### Example login response\n\n```json\n{\n  \"success\": true,\n  \"data\": \"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjE1ZmUyOGI4NTFmM2I1Mjc0MGVkNjFlYzM4ZDgyZmQ2M2ZhYmY1NDM5NjI0ZDZlZDViODAwZDFkMDU2MjBiNjdlYzE3MDNjYzU3MzYwNTcxIn0.eyJhdWQiOiIxIiwianRpIjoiMTVmZTI4Yjg1MWYzYjUyNzQwZWQ2MWVjMzhkODJmZDYzZmFiZjU0Mzk2MjRkNmVkNWI4MDBkMWQwNTYyMGI2N2VjMTcwM2NjNTczNjA1NzEiLCJpYXQiOjE1NjYyNjI5NzEsIm5iZiI6MTU2NjI2Mjk3MSwiZXhwIjoxNTk3ODg1MzcxLCJzdWIiOiIxIiwic2NvcGVzIjpbXX0.aUBUPQDpiHLYR7-ZQHttYPe59ubTBxGgOs8WktDxqv5nlG4WqMIOtfARpdt56NTkD9SrEH1Xo9MaCCLswif25y3xNObHl5MM_X7j1nXE59kHmQt0waqIHq1yCLzVuBtbGkuflZQY4QfM59SKDikGmPNvH98uZjz2wxuah7FF8c5oADxjcBVAuZKfJaewwPSh49qck0dgB-IOpiJ38ihaYiMZCh1DTZJwbot2Pzfs54q9QY2S5_CzBv5z56z4-eb4ylkIn7PtaxcjzZnCWK8f8nxYFQHuKd6awyv6bHK6c3MzFjcXQ1Zl9oUUHvrRV-9qIzv6Ot73amVKitDafOXmaC6_oG-bURcl8wVOMVi9GSkrc2j6ZjljDs2w83YhNtglT9Fy10CoDMUBh6HwaLejjwv91dTRhUQ91CoCRtoFCIp7Pq2OG5bM3cNDCUjsn72gCEG_u4WJ_aK8zIx7tmhmfU-nvtctEFoMSSJJ1NYeE0W53jahFeTVVSEd7yJEgk53mlSNgKUw3Q2XfonV6bW-iD2BPd_XCGobh9uIPt5PQdoGZUDP75-njkPIYqUELvSR1n3pUJwLx4smBK-rgzk8TR7LShG2P5gH1AP6qAtrs0ufwHH_3-JL5U5tlGAt7_t3x23opnX-I63KFwD5OhJl_39ran3B91xUwD8y2m-6VQ0\"\n}\n```\n\n#### Example authorized request with token\n\n```bash\ncurl --location --request GET \"http://localhost:8080/api/profile\" \\\n  --header \"Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjM1ZjQ5NTU1N2QzYmEyNjM5OTQzYmQzY2JlMTU1MTI0NmIyZmJiMzc4NGY2ZTJmNTgwOGZlM2Y3YjNiMGM0ZjlkZTM2MzY2ZGNkZTFhOWJjIn0.eyJhdWQiOiIxIiwianRpIjoiMzVmNDk1NTU3ZDNiYTI2Mzk5NDNiZDNjYmUxNTUxMjQ2YjJmYmIzNzg0ZjZlMmY1ODA4ZmUzZjdiM2IwYzRmOWRlMzYzNjZkY2RlMWE5YmMiLCJpYXQiOjE1NjYyNjQ2NjksIm5iZiI6MTU2NjI2NDY2OSwiZXhwIjoxNTk3ODg3MDY5LCJzdWIiOiIyIiwic2NvcGVzIjpbXX0.Xf7HGFczhfbXNMtycA3k9O-0FYYkH4Oj-LLJQm4P5br5DwJOf0ScQ0Gb5wKA2k6T1QuYNy6D4h_wGzCUICuvmFHyQ0pTlkUL_2RjefjHy1mIuTPCUkgxFVjAn0qUIBgakrb_I2OXGgRZlO_00eyYRiSaMBtcuEkRljVpJG8EL8JDdTFFEqgoSXrGDfQqubBEW0_IjDw33NXrFVtK-aJQdkTpGNUwr0aSVMT_GcX7u7vJjvCa3Jc50unGXZI6VDpwxsvndAyuuvu8AbRhmN7TNJhCNynT55m4X0ZY9xLH_WAEoT7uI5ei5DdBAfH1_Ux0nJxHLFGaXI15N_OAw8noVgPSPps8Bbn9fsWu7ZqGvj-2gUupVrWS1FVk5qBYzKnV4Osdsl0pRjVfY9yghIRTCGonxCU_A2Fl-i8OUVPUl6iqGxiko2KBo8qqLWQbT3IkUXyB578DAIqgqfZ9gr122B0J5ukyIYtLLHKo0HqYc9NjB2K11ntfB6SPXJBEY6Xrts8xm_0uT1fJ2pIXuvICtC-cUBDioUZ842ijeOJm4h_vESzsqJXQ4Xp32PCvcjHxO9X9EJe5JnDdHD5nlVDeEl4ZtpBZ4zZeef3yXsdMPxwGGiTrwNMZyLHnzWdiNAhZfo13Pk4z9XswDK8omIdtKuEPAIQXT2Z9Gu4keVaI0fQ\" \\\n  --header \"Content-Type: application/json\" \\\n  --header \"X-Requested-With: XMLHttpRequest\" \\\n  --data \"\"\n```\n\n## Tests\n\nAs default tests are configured to work with travis when you push commit to github repo.\u003cbr\u003e\u003cbr\u003e\nIf you want to run tests locally go to `phpunit.xml` file in root directory and change `DB_CONNECTION` value to `sqlite\n`.\u003cbr\u003e\nThen as normally run command `./vendor/bin/phpunit`.\u003cbr\u003e\u003cbr\u003e\n\u003csmall\u003eRemember to change that value back for `testing` when you push repo to github, otherwize your commit test will\n fail.\u003c/small\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frafal-kucharski%2Frest-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frafal-kucharski%2Frest-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frafal-kucharski%2Frest-api/lists"}