{"id":22446991,"url":"https://github.com/cloudcreativity/demo-laravel-json-api","last_synced_at":"2025-08-01T21:32:28.312Z","repository":{"id":51800375,"uuid":"60010834","full_name":"cloudcreativity/demo-laravel-json-api","owner":"cloudcreativity","description":"Demo of JSON API integration with a Laravel Application","archived":false,"fork":false,"pushed_at":"2021-05-09T23:12:53.000Z","size":1824,"stargazers_count":80,"open_issues_count":8,"forks_count":25,"subscribers_count":5,"default_branch":"5.6","last_synced_at":"2023-03-02T22:22:33.706Z","etag":null,"topics":["json-api","laravel","php"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":false,"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/cloudcreativity.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}},"created_at":"2016-05-30T13:08:14.000Z","updated_at":"2022-12-06T03:48:57.000Z","dependencies_parsed_at":"2022-08-17T15:15:20.689Z","dependency_job_id":null,"html_url":"https://github.com/cloudcreativity/demo-laravel-json-api","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudcreativity%2Fdemo-laravel-json-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudcreativity%2Fdemo-laravel-json-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudcreativity%2Fdemo-laravel-json-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudcreativity%2Fdemo-laravel-json-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudcreativity","download_url":"https://codeload.github.com/cloudcreativity/demo-laravel-json-api/tar.gz/refs/heads/5.6","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228407877,"owners_count":17915083,"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":["json-api","laravel","php"],"created_at":"2024-12-06T04:13:39.506Z","updated_at":"2024-12-06T04:13:40.190Z","avatar_url":"https://github.com/cloudcreativity.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel JSON API Demo\n\nThis application demonstrates how to use the \n[cloudcreativity/laravel-json-api](https://github.com/cloudcreativity/laravel-json-api)\npackage to create a [JSON API](http://jsonapi.org) compliant API. This is demonstrated using Eloquent models as\nthe domain records that are serialized in the API, but the package is not Eloquent specific.\n\n## Setup\n\nThe application uses [Homestead](https://laravel.com/docs/homestead), so you'll need Vagrant installed on your\nlocal machine.\n\nOnce you've cloned this repository, change into the project folder then:\n\n``` bash\ncomposer install\ncp .env.example .env\nphp vendor/bin/homestead make\nvagrant up\n```\n\n\u003e Remember you'll need to add an entry for `homestead.app` in your `/etc/hosts` file.\n\nOnce it is up and running, go to the following address in your browser to see the JSON endpoints:\n\n```\nhttp://homestead.app/api/v1/posts\n```\n\nTo access the web interface:\n\n```\nhttp://homestead.app\n```\n\n\u003e If you use the Vagrant hosts updater plugin, the hostname may be `demo-laravel-json-api` or similar. \n\n## Authentication\n\nAny write requests require an authenticated user. We've installed \n[Laravel Passport](https://laravel.com/docs/passport) for API authentication. You will need to use\n[Personal Access Tokens](https://laravel.com/docs/passport#personal-access-tokens) and the Vagrant provisioning\nruns the Passport installation command.\n\nTo create a token, go to the web interface and login (the username and password fields are completed with\ncredentials that will sign you in successfully). You'll then see the Passport Person Access Token component\nwhich you can use to issue tokens.\n\nOnce you have a token, send a request as follows, replacing the `\u003capi_token\u003e` with your token.\n\n```http\nPOST http://homestead.app/api/v1/posts\nAccept: application/vnd.api+json\nContent-Type: application/vnd.api+json\nAuthorization: Bearer \u003capi_token\u003e\n\n{\n    \"data\": {\n        \"type\": \"posts\",\n        \"attributes\": {\n            \"slug\": \"hello-world\",\n            \"title\": \"Hello World\",\n            \"content\": \"...\"\n        }\n    }\n}\n```\n\n## Eloquent vs Not-Eloquent\n\nThis package can handle both Eloquent and non-Eloquent records. You get a lot more functionality out of the box if\nyou are using Eloquent, but it's possible to integrate non-Eloquent records as needed.\n\nThis demo includes the following JSON-API resources:\n\n| Resource | Record | Eloquent? |\n| --- | --- | --- |\n| comments | App\\Comment | Yes |\n| posts | App\\Post | Yes |\n| sites | App\\Site | No |\n| tags | App\\Tag | Yes |\n| users | App\\User | Yes |\n\n## Tests\n\nWe're big on testing, and the `cloudcreativity/laravel-json-api` package comes with test helpers to make integration \ntesting a JSON API a breeze. You can see this in action in the `tests/Integration` folder, where there's a test case\nfor the `posts` resource.\n\nTo run the tests:\n\n```bash\nvendor/bin/phpunit\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudcreativity%2Fdemo-laravel-json-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudcreativity%2Fdemo-laravel-json-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudcreativity%2Fdemo-laravel-json-api/lists"}