{"id":20376138,"url":"https://github.com/cartalyst/demo-api","last_synced_at":"2025-04-12T07:37:05.022Z","repository":{"id":12964513,"uuid":"15642929","full_name":"cartalyst/demo-api","owner":"cartalyst","description":"Demo of Cartalyst's API V2 for Laravel 4.1+","archived":false,"fork":false,"pushed_at":"2014-10-25T00:00:49.000Z","size":9008,"stargazers_count":28,"open_issues_count":0,"forks_count":10,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-26T02:51:06.310Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cartalyst.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-01-05T00:55:10.000Z","updated_at":"2021-01-13T19:40:34.000Z","dependencies_parsed_at":"2022-08-28T10:12:12.516Z","dependency_job_id":null,"html_url":"https://github.com/cartalyst/demo-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cartalyst%2Fdemo-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cartalyst%2Fdemo-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cartalyst%2Fdemo-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cartalyst%2Fdemo-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cartalyst","download_url":"https://codeload.github.com/cartalyst/demo-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248536007,"owners_count":21120676,"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":[],"created_at":"2024-11-15T01:35:46.467Z","updated_at":"2025-04-12T07:37:04.988Z","avatar_url":"https://github.com/cartalyst.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# API Demo\n\nThis demo works to serve as a real-life demo of Cartalyst's API V2 for Laravel 4.1. The package is a work-in-progress and therefore this demo is as well.\n\nThis demo is a mockup of Foursqure and the following entities:\n\n1. Places\n2. Users\n3. Checkins\n\nData is seeded to the database by Laravel's seeding. We utilise our API package for internal API requests - allowing you to build API-first applications (an abstraction where your application's controllers talk [in runtime] directly to your RESTful API).\n\nThis demo is following [Phil Sturgeon's](https://github.com/philsturgeon) recommendations for [building a decent RESTful API](http://philsturgeon.co.uk/blog/2013/07/building-a-decent-api).\n\nWe are also utilising [The League of Extraordinary Packages'](http://thephpleague.com) REST API helper package, [Fractal](https://github.com/php-loep/fractal).\n\nFor more information on using Fractal to build awesome REST APIs, see [Build APIs You Won't Hate](https://leanpub.com/build-apis-you-wont-hate).\n\n\n## Installation\n\nTo install this demo, firstly you must be a subscriber of Cartalyst's [Arsenal](http://cartalyst.com/arsenal).\n\nInstallation:\n\n1. Clone this repo:\n\n```\ngit clone git@github.com:cartalyst/api-demo.git\n```\n\n2. Setup your virtual host.\n\n3. Go into the directory in your terminal app and install composer dependencies:\n\n```\ncomposer install\n```\n\n4. Configure your database connection.\n\n5. Run migrations for Sentinel and the main application\n\n```\nphp artisan migrate --package=cartalyst/sentinel\nphp artisan migrate\n```\n\n6. Seed your database (you can do this as many times as you want, it will reset the database each time).\n\n```\nphp artisan db:seed\n```\n\n## API Usage\n\nWe have fulfilled the basic ~~C~~RUD processed for a \"place\" entity. Begin by hitting the following endpoint on your app:\n\n```\nGET /api/v1/places HTTP/1.1\nHost: api.dev\n```\n\nExcerpt From: Phil Sturgeon. “Build APIs You Won't Hate.” iBooks.\n\nThis will return a nicely formatted array of available places. You may also nest in checkins for each place and associated users (which was populated through the seeding process above). To have a play with this, get your favorite HTTP client (I like the [Postman REST Client](https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en) for Chrome):\n\n```\nGET /api/v1/places?include=checkins HTTP/1.1\nHost: api.dev\n```\n\n```\nGET /api/v1/places?include=checkins.user HTTP/1.1\nHost: api.dev\n```\n\nTake a look at `app/routes.php` for the endpoints we've implemented in this basic demo.\n\nYou may also perform a `PUT` request following URI to update a place, for example (note, our API demo is expecting JSON-encoded data, and so should your API, ditch that form-url-encoded junk):\n\n```\nPUT /api/v1/places/1 HTTP/1.1\nHost: api.dev\n```\n\n```\n{\"name\":\"New Name\",\"address\",\"123 Fake Street\\nFake City\"}\n```\n\nAnd of course, you may `DELETE` a place:\n\n```\nDELETE /api/v1/places/1 HTTP/1.1\nHost: api.dev\n```\n\nAt this stage, we've not built endpoints for creating places, because that can happen through database seeding. This is a demo only, not a full app :)\n\n## Admin Usage\n\nOnce again, being a demo, there's no admin filters, nothing too fancy, just routes to simulate an admin interface.\n\nTo begin, navigate your browser to `http://api.dev/admin/places` (substituting your HTTP host in). The rest is obvious, you may edit/delete places. The code is where you want to look though, to see the interactions between the admin controllers and the API controllers, to see how requests are created at runtime and objects are returned.\n\n\u003e *Note:* This demo is not a fully-fledged app. It's a demo, so we're not covering every possible scenario or completed every endpoint.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcartalyst%2Fdemo-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcartalyst%2Fdemo-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcartalyst%2Fdemo-api/lists"}