{"id":23179152,"url":"https://github.com/francis94c/ci-rest","last_synced_at":"2026-04-15T22:35:30.891Z","repository":{"id":157580369,"uuid":"199943309","full_name":"francis94c/ci-rest","owner":"francis94c","description":"A REST API Library/Framework for Code Igniter.","archived":false,"fork":false,"pushed_at":"2020-04-18T16:14:07.000Z","size":61,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-05T02:17:11.764Z","etag":null,"topics":["ci-rest","codeigniter","igniter","php","rest"],"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/francis94c.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-07-31T23:38:24.000Z","updated_at":"2020-04-18T11:10:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"45df3565-d11f-4349-99f6-4ac286b834e6","html_url":"https://github.com/francis94c/ci-rest","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/francis94c/ci-rest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/francis94c%2Fci-rest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/francis94c%2Fci-rest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/francis94c%2Fci-rest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/francis94c%2Fci-rest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/francis94c","download_url":"https://codeload.github.com/francis94c/ci-rest/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/francis94c%2Fci-rest/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31863495,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"ssl_error","status_checked_at":"2026-04-15T15:24:39.138Z","response_time":63,"last_error":"SSL_read: 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":["ci-rest","codeigniter","igniter","php","rest"],"created_at":"2024-12-18T07:13:59.374Z","updated_at":"2026-04-15T22:35:30.877Z","avatar_url":"https://github.com/francis94c.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/francis94c/ci-rest.svg?branch=master)](https://travis-ci.org/francis94c/ci-rest) [![Coverage Status](https://coveralls.io/repos/github/francis94c/ci-rest/badge.svg?branch=master)](https://coveralls.io/github/francis94c/ci-rest?branch=master) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/francis94c/ci-rest/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/francis94c/ci-rest/?branch=master)\n\n# ci-rest\nA REST API Library/Framework for Code Igniter.\n\nThis library is currently in progress together with another project that depends on it, so as to enable me design it in such a way that cuts through various applications.\n\nI'll be documenting along the way, before the full code finally makes it here for its first release.\n\n# Synopsis\n\nThis library makes it possible to develop REST servers in Code Igniter, having your code responsible for validating authorizations in one place and the codes for actually accessing resources in another place.\n\nThis allows you write uniform maintainable server-side code.\n\nThink of it as a library that validates clients as per your specifications, and let's your main code run if authorization passes.\n\nYou also get to take actions or customize responses when authorization fails.\n\nThis also takes care of API Rate Limiting.\n\nA very detailed write up of how to install and use this library follows below.\n\n\n### Installation ###\nDownload and Install Splint from https://splint.cynobit.com/downloads/splint and run the below from the root of your Code Igniter project.\n```bash\nsplint install francis94c/ci-rest\n```\n\n### Usage ###\nYou can load the library anywhere as below.\n```php\n$this-\u003eload-\u003epackage('francis94c/ci-rest');\n```\nIf your Code Igniter is a full REST API, It'll be better to add the package name to the `$config['splint']` array in `config/autoload.php`.\n```php\n$config['splint'] [\n  'francis94c/ci-rest'\n];\n```\nThen create authentication rules amongst other rules that must be processed in a file `config/rest.php` every time the library is loaded.\nBelow is a sample config file\n```php\ndefined('BASEPATH') OR exit('No direct script access allowed');\n\n$config['api_key_header'] = \"X-API-KEY\";\n\n$config['auth'] = [\n  RESTAuth::BASIC,\n  RESTAuth::API_KEY =\u003e REST::AUTH_GRAVITY,\n  RESTAuth::BEARER  =\u003e REST::AUTH_PASSIVE | REST::AUTH_FINAL,\n  RESTAuth::SECRET\n];\n\n$config['auth_callbacks'] = [\n  RESTAuth::SECRET =\u003e function (\u0026$context, $token):bool {\n    return $token == 'valid';\n  },\n  RESTAuth::BEARER =\u003e function (\u0026$context, $token) {\n    return false;\n  }\n];\n\n$config['response_callbacks'] = [\n  RESTResponse::BAD_REQUEST =\u003e function(\u0026$auth, $reason):void {\n    echo(json_encode([\n      'error' =\u003e $reason\n    ]));\n  },\n  RESTResponse::UN_AUTHORIZED =\u003e function(\u0026$auth):void {\n    echo(json_encode([\n      'error' =\u003e 'UnAuthorized'\n    ]));\n  },\n  RESTResponse::NOT_ACCEPTABLE =\u003e function(\u0026$auth):void {\n    echo (json_encode([\n      'error' =\u003e 'Not Acceptable'\n    ]));\n  },\n  RESTResponse::NOT_IMPLEMENTED =\u003e function(\u0026$auth): void {\n    echo (json_encode([\n      'error' =\u003e \"$auth Authentication not implemented\"\n    ]));\n  }\n];\n\n$config['api_limiter'] = [\n  'api_limiter'    =\u003e true,\n  'per_hour'       =\u003e 100,\n  'show_header'    =\u003e true,\n  'header_prefix'  =\u003e 'X-RateLimit-',\n  'limit_by_ip'    =\u003e false,\n  'ip_per_hour'    =\u003e 50,\n  'whitelist'      =\u003e [\n    '127.0.0.1',\n    '::1'\n  ]\n];\n\n$config['api_key_auth'] = [\n  'api_key_table'        =\u003e 'api_keys',\n  'api_key_column'       =\u003e 'api_key',\n  'api_key_limit_column' =\u003e '_limit',\n];\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrancis94c%2Fci-rest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrancis94c%2Fci-rest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrancis94c%2Fci-rest/lists"}