{"id":45423680,"url":"https://github.com/rmhdev/cercanias-api","last_synced_at":"2026-02-22T01:44:54.532Z","repository":{"id":18397896,"uuid":"21579295","full_name":"rmhdev/cercanias-api","owner":"rmhdev","description":"HTTP REST API built to access Renfe's Cercanias information","archived":false,"fork":false,"pushed_at":"2014-08-03T10:08:57.000Z","size":340,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-09T21:04:59.051Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rmhdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-07-07T17:12:18.000Z","updated_at":"2016-09-13T18:54:05.000Z","dependencies_parsed_at":"2022-09-09T23:41:01.356Z","dependency_job_id":null,"html_url":"https://github.com/rmhdev/cercanias-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rmhdev/cercanias-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmhdev%2Fcercanias-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmhdev%2Fcercanias-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmhdev%2Fcercanias-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmhdev%2Fcercanias-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rmhdev","download_url":"https://codeload.github.com/rmhdev/cercanias-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmhdev%2Fcercanias-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29703227,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T23:35:04.139Z","status":"ssl_error","status_checked_at":"2026-02-21T23:35:03.832Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":"2026-02-22T01:44:54.105Z","updated_at":"2026-02-22T01:44:54.525Z","avatar_url":"https://github.com/rmhdev.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cercanias API\n\nAccess Renfe's Cercanias information through a HTTP REST API.\n\n[![Build Status](https://travis-ci.org/rmhdev/cercanias-api.svg?branch=master)](https://travis-ci.org/rmhdev/cercanias-api)\n\n## Requirements\n\nThe `cercanias-api` project has the following requirements:\n\n- `PHP 5.3+`\n- A `HTTP` server (Apache, nginx, ...)\n\n## Installation\n\nThe easiest way to install it is to clone the repository:\n\n```\ngit clone https://github.com/rmhdev/cercanias-api\n```\n\nAfter that you'll need to install [Composer][]:\n\n```bash\ncurl -sS https://getcomposer.org/installer | php\n```\n\nFinally, you'll be able to retrieve all the dependencies:\n\n```bash\nphp ./composer.phar install\n```\n\n### Configure the server\n\nThis project is built using [Silex][].\nThe official docs will give you more information about [how to configure your server][]. Make sure that:\n\n- the **document root** points to the `cercanias-api/web/` directory.\n- folders in `cercanias-api/var/` must be **writable** by the web server.\n\n## Play with the API\n\nIf you are using PHP 5.4+, its built-in web server will help you to play with this project:\n\n```bash\nphp -S localhost:8080 -t web web/index.php\n```\n\nEasy, right? Just open a browser and enter `http://localhost:8080`\n\n## API requests\n\nIndex urls:\n\n```\nGET -\u003e http://localhost:8080\n```\n\nRetrieve all the routes:\n\n```\nGET -\u003e http://localhost:8080/route\n```\n\nRetrieve the stations from a route:\n\n```\nGET -\u003e http://localhost:8080/route/{routeId}\n```\n\nRetrieve the timetable for a query:\n\n```\nGET -\u003e http://localhost:8080/timetable/{routeId}/{departureId}/{destinationId}/{date}\n```\n\n**Information about the parameters:**\n\n- `{routeId}`: (string) route id. For example, Madrid is `10`.\n- `{departureId}` and `{destinationId}`: (string) station id. For example, Oviedo is `15211`.\n- `{date}`: (string). Read more about [accepted date formats][]. For example, `2014-07-25`, `today`, `tomorrow`, etc.\n\n## API responses\n\n### Index url\n\n```\nGET -\u003e http://localhost:8080\n```\n\n```json\n{\n    \"routes_url\": \"http://localhost:8080/route\",\n    \"route_url\": \"http://localhost:8080/route/{routeId}\",\n    \"timetable_url\": \"http://localhost:8080/timetable/{routeId}/{fromId}/{toId}/{date}\"\n}\n```\n\n### Routes url\n\n```\nGET -\u003e http://localhost:8080/route\n```\n\n```json\n{\n    \"routes\": [\n        {\n            \"id\": 20,\n            \"name\": \"Asturias\",\n            \"url\": \"http://localhost:8080/route/20\"\n        },\n        // ...\n    ]\n}\n```\n\n### Route url\n\n```\nGET -\u003e http://localhost:8080/route/61\n```\n\n```json\n{\n    \"id\": \"61\",\n    \"name\": \"San Sebastián\",\n    \"url\": \"http://localhost:8080/route/61\",\n    \"stations\": [\n        {\n            \"id\": \"11409\",\n            \"name\": \"Alegia de Oria\",\n            \"route_id\": \"61\"\n        },\n        // ...\n    ]\n}\n```\n\n### Timetable url\n\n```\nGET -\u003e http://localhost:8080/timetable/61/11305/11600/2014-07-23\n```\n\n```json\n{\n    \"departure\": {\n        \"id\": \"11305\",\n        \"name\": \"Brincola\",\n        \"route_id\": \"61\"\n    },\n    \"destination\": {\n        \"id\": \"11600\",\n        \"name\": \"Irun\",\n        \"route_id\": \"61\"\n    },\n    \"transfer\": false,\n    \"route\": {\n        \"id\": \"61\",\n        \"name\": \"San Sebastián\",\n        \"url\": \"http://localhost:8080/route/61\"\n    },\n    \"date\": \"2014-07-23T00:00:00+02:00\",\n    \"return_url\": \"http://localhost:8080/timetable/61/11600/11305/2014-07-23\",\n    \"trips\": [\n        {\n            \"line\": \"c1\",\n            \"departure\": \"2014-07-23T05:53:00+02:00\",\n            \"arrival\": \"2014-07-23T07:23:00+02:00\",\n            \"transfers\": []\n        },\n        // ...\n    ]\n}\n```\n\nSimilar response, but with transfer trains:\n\n```\nGET -\u003e http://localhost:8080/timetable/50/79600/71802/2014-07-23\n```\n\n```json\n{\n    \"departure\": {\n        \"id\": \"79600\",\n        \"name\": \"Arenys de Mar\",\n        \"route_id\": \"50\"\n    },\n    \"destination\": {\n        \"id\": \"71802\",\n        \"name\": \"Barcelona-Passeig de Gràcia\",\n        \"route_id\": \"50\"\n    },\n    \"transfer\": {\n        \"id\": \"\",\n        \"name\": \"Barcelona-El Clot-Aragò\",\n        \"route_id\": \"50\"\n    },\n    \"route\": {\n        \"id\": \"50\",\n        \"name\": \"Barcelona\",\n        \"url\": \"http://localhost:8080/route/50\"\n    },\n    \"date\": \"2014-07-23T00:00:00+02:00\",\n    \"return_url\": \"http://localhost:8080/timetable/50/71802/79600/2014-07-23\",\n    \"trips\": [\n        {\n            \"line\": \"r1\",\n            \"departure\": \"2014-07-23T05:59:00+02:00\",\n            \"arrival\": \"2014-07-23T06:49:00+02:00\",\n            \"transfers\": [\n                {\n                    \"line\": \"r2\",\n                    \"departure\": \"2014-07-23T06:56:00+02:00\",\n                    \"arrival\": \"2014-07-23T07:01:00+02:00\"\n                },\n                {\n                    \"line\": \"r2\",\n                    \"departure\": \"2014-07-23T07:10:00+02:00\",\n                    \"arrival\": \"2014-07-23T07:15:00+02:00\"\n                }\n            ]\n        },\n        // ...\n    ]\n}\n```\n\n## Copyright and license\n\nCode and documentation copyright 2014 Rober Martín H.\nCode released under [MIT license](LICENSE).\nDocs released under [Creative Commons CC BY 4.0][].\n\n## Author\n\nMy name is [Rober Martín H][] ([@rmhdev][]). I'm a developer from Donostia / San Sebastián.\n\n[Silex]: http://silex.sensiolabs.org/\n[how to configure your server]: http://silex.sensiolabs.org/doc/web_servers.html\n[Composer]: https://getcomposer.org/\n[accepted date formats]: http://php.net/manual/en/datetime.formats.date.php\n[Creative Commons CC BY 4.0]: http://creativecommons.org/licenses/by/4.0/\n[Rober Martín H]: http://rmhdev.net/\n[@rmhdev]: http://twitter.com/rmhdev\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frmhdev%2Fcercanias-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frmhdev%2Fcercanias-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frmhdev%2Fcercanias-api/lists"}