{"id":22044796,"url":"https://github.com/cradlephp/cradle-api","last_synced_at":"2025-03-23T14:14:18.462Z","repository":{"id":56958544,"uuid":"135563116","full_name":"CradlePHP/cradle-api","owner":"CradlePHP","description":"App, scope, OAuth2, REST, webhooks and stateless session management for CradlePHP","archived":false,"fork":false,"pushed_at":"2020-06-20T10:43:25.000Z","size":120,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-01T01:47:17.360Z","etag":null,"topics":["cradle","cradlephp","oauth2","rest","v2","webhooks"],"latest_commit_sha":null,"homepage":"http://cradlephp.github.io","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/CradlePHP.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":"2018-05-31T09:34:18.000Z","updated_at":"2019-10-25T03:07:43.000Z","dependencies_parsed_at":"2022-08-21T09:50:18.562Z","dependency_job_id":null,"html_url":"https://github.com/CradlePHP/cradle-api","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CradlePHP%2Fcradle-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CradlePHP%2Fcradle-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CradlePHP%2Fcradle-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CradlePHP%2Fcradle-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CradlePHP","download_url":"https://codeload.github.com/CradlePHP/cradle-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245111946,"owners_count":20562512,"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":["cradle","cradlephp","oauth2","rest","v2","webhooks"],"created_at":"2024-11-30T13:08:35.084Z","updated_at":"2025-03-23T14:14:18.429Z","avatar_url":"https://github.com/CradlePHP.png","language":"PHP","readme":"# cradle-api\n\nA developer management and API generator that includes management for the following.\n - **Developer Applications** - Developers can create applications with tokens for rest calls and webhooks\n - **API Scopes** - Admins can group REST calls into scopes which are options that developer apps can use\n - **OAuth2 Server** - Same protocols used in popular websites; developers can enable users to share their information with other applications\n - **REST Generator** - Admins can create standard REST calls without needing to program\n - **Webhook Generator** - Admins can create events that notifies 3rd party apps through developer apps\n - **API Session Management** - Admins can view activity and revoke access manually to any API users on the fly\n\n## Install\n\nIf you already installed Cradle, you may not need to install this because it\nshould be already included.\n\n```\n$ composer require cradlephp/cradle-api\n$ bin/cradle cradlephp/cradle-api install\n$ bin/cradle cradlephp/cradle-api sql-populate\n```\n\n## How to Use\n\nBy default the `cradle-api` package tables will be empty. You can use this SQL script to manually populate it.\n\n[api.sql](https://github.com/CradlePHP/cradle-api/files/2795216/api.txt)\n\nSo when you populate the API schemas a new section `/developer/app/search` will be available. This is like facebook developer portal (but more raw). It also auto creates docs `/developer/docs/scopes` and `/developer/docs/webhooks`.\n\n### REST\n\nThere's 3 kinds of rest calls:\n\n - Public REST call: `/rest/public/profile/search`\n - App REST call: `/rest/public/profile/detail/1?client_id=94341e9d0776b73cc7142cc161faf0e688fdbfb2`\n - User REST call: `/rest/user/app/search?access_token=8cddabc765dbba7cccaa156105af08c04455775c`\n\nYou can expect this is following OAuth v2 specs *(as well as Facebook's REST style)* very closely. The following screenshot shows what the form fields are for in `/admin/system/model/rest/create`.\n\n![image](https://user-images.githubusercontent.com/120378/51734253-f652b000-20be-11e9-84dc-b4f89bfb778c.png)\n\nPaths in REST calls can also take route parameters like `/profile/detail/:profile_id` that will also be apart of the event call parameters.\n\n### Web Hooks\n\nThen web hooks are like Github's web hooks.\n\n![image](https://user-images.githubusercontent.com/120378/51734233-e3d87680-20be-11e9-9e3d-51bb4f811fe4.png)\n\nWhen you create a web hook it will then be available to the application to utilize. But beware the web hook url given should be valid, or else every time you create a profile, it will be slow *(because it's trying to call that web hook url)*.\n\n![image](https://user-images.githubusercontent.com/120378/51734341-331ea700-20bf-11e9-9d45-cb3f23d132df.png)\n\nThis way allows to create APIs without needing to program. but, you can also program in your own REST calls and webhooks manually in any `controller.php`. We are not stopping you from doing that.\n\n## OAuth v2\n\nIn `/developer/app/search` you can also try the 3-legged OAuth yourself.\n\n![image](https://user-images.githubusercontent.com/120378/51734476-9d374c00-20bf-11e9-8ef7-2e1c0c20a366.png)\n\nThis will redirect you to `/dialog/request?client_id=94341e9d0776b73cc7142cc161faf0e688fdbfb2`. You can use this same URL to authenticate via 3-Legged OAuth. For now, just click `Allow`.\n\n![image](https://user-images.githubusercontent.com/120378/51734763-6d3c7880-20c0-11e9-8ea9-23938c7ff9b7.png)\n\nWhen your done that it will return you back to the same screen with the same URL except with a code parameter. (ie. `/developer/app/search?code=1234567890`). If you have POST MAN you can call `POST /rest/access?client_id=[your app key]\u0026client_secret=[your app secret]\u0026code=[the code you got earlier]`. That will return session tokens in JSON as in the following.\n\n```\nPOST /rest/access?client_id=94341e9d0776b73cc7142cc161faf0e688fdbfb2\u0026client_secret=d490f575cd1c48e1b970bb0427ae4ec2b2636403\u0026code=b75272cbf7edbb7a434f77e904a27beb4fe08be7\n\n{\n    \"error\": false,\n    \"results\": {\n        \"access_token\": \"f7b9427a17ad4f083fb109ba382a99ca\",\n        \"access_secret\": \"9d5b6d575f13f2c14c5fa8cc843c07fd\",\n        \"profile_id\": \"1\",\n        \"profile_name\": \"John Doe\",\n        \"profile_created\": \"2019-01-20 06:43:42\"\n    }\n}\n```\n\n----\n\n\u003ca name=\"contributing\"\u003e\u003c/a\u003e\n# Contributing to Cradle PHP\n\nThank you for considering to contribute to Cradle PHP.\n\nPlease DO NOT create issues in this repository. The official issue tracker is located @ https://github.com/CradlePHP/cradle/issues . Any issues created here will *most likely* be ignored.\n\nPlease be aware that master branch contains all edge releases of the current version. Please check the version you are working with and find the corresponding branch. For example `v1.1.1` can be in the `1.1` branch.\n\nBug fixes will be reviewed as soon as possible. Minor features will also be considered, but give me time to review it and get back to you. Major features will **only** be considered on the `master` branch.\n\n1. Fork the Repository.\n2. Fire up your local terminal and switch to the version you would like to\ncontribute to.\n3. Make your changes.\n4. Always make sure to sign-off (-s) on all commits made (git commit -s -m \"Commit message\")\n\n## Making pull requests\n\n1. Please ensure to run [phpunit](https://phpunit.de/) and\n[phpcs](https://github.com/squizlabs/PHP_CodeSniffer) before making a pull request.\n2. Push your code to your remote forked version.\n3. Go back to your forked version on GitHub and submit a pull request.\n4. All pull requests will be passed to [Travis CI](https://travis-ci.org/CradlePHP/cradle-api) to be tested. Also note that [Coveralls](https://coveralls.io/github/CradlePHP/cradle-api) is also used to analyze the coverage of your contribution.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcradlephp%2Fcradle-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcradlephp%2Fcradle-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcradlephp%2Fcradle-api/lists"}