{"id":36996242,"url":"https://github.com/kontenbase/kontenbase-php","last_synced_at":"2026-01-13T23:48:36.379Z","repository":{"id":41091768,"uuid":"495284471","full_name":"kontenbase/kontenbase-php","owner":"kontenbase","description":"Kontenbase SDK for PHP","archived":false,"fork":false,"pushed_at":"2022-06-02T11:02:30.000Z","size":11,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-11-27T18:49:56.782Z","etag":null,"topics":["backend","database","php","rest-api","sdk"],"latest_commit_sha":null,"homepage":"https://kontenbase.com","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/kontenbase.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":"2022-05-23T06:27:11.000Z","updated_at":"2023-03-01T15:10:10.000Z","dependencies_parsed_at":"2022-07-30T20:47:59.689Z","dependency_job_id":null,"html_url":"https://github.com/kontenbase/kontenbase-php","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kontenbase/kontenbase-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kontenbase%2Fkontenbase-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kontenbase%2Fkontenbase-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kontenbase%2Fkontenbase-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kontenbase%2Fkontenbase-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kontenbase","download_url":"https://codeload.github.com/kontenbase/kontenbase-php/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kontenbase%2Fkontenbase-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28405431,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"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":["backend","database","php","rest-api","sdk"],"created_at":"2026-01-13T23:48:36.319Z","updated_at":"2026-01-13T23:48:36.374Z","avatar_url":"https://github.com/kontenbase.png","language":"PHP","readme":"# Kontenbase\n\nThis is the Official PHP client for Kontenbase API.\n\nKontenbase is a no-code backend API platform or Backend as a Service (BaaS) that allows you to create a backend API as fast as possible. We make it easy for developers to build backend API without having to touch backend code at all.\n\nVisit [Kontenbase](https://kontenbase.com/) for more information and see [our documentation](https://docs.kontenbase.com/) for more technical details.\n\n## API Documentation\n\nFor API documentation, visit [Kontenbase API Reference](https://docs.kontenbase.com/).\n\n## Installation\n\nTo install the SDK you can use Composer or directly download the source and extract to your directory. If you’re using Composer, run this following command:\n\n```bash\ncomposer require kontenbase/sdk\n```\n\n## Usage\n\nBefore you begin, you need to sign up on [Kontenbase Dashboard](https://app.kontenbase.com/) to retrieve an **API key** of your project.\n\n### **Create a client**\n\n```php\n\u003c?php\n\nuse Kontenbase\\KontenbaseClient;\n\n$kontenbase = new KontenbaseClient([\n\t'apiKey': 'YOUR_API_KEY' // Your API Key from app.kontenbase.com\n]);\n```\n\n## Authentication\n\n### **Register**\n\n```php\n$res = $kontenbase-\u003eauth-\u003eregister([\n\t'firstName' =\u003e 'Ega',\n\t'lastName' =\u003e 'Radiegtya',\n\t'email' =\u003e 'user@mail.com',\n\t'password' =\u003e 'password'\n]);\n\necho $res['user']; // The data of registered user\necho $res['token']; // The token of registered user\n```\n\n### **Login**\n\n```php\n$res = $kontenbase-\u003eauth-\u003elogin([\n\t'email' =\u003e 'user@mail.com',\n\t'password' =\u003e 'password'\n]);\n\necho $res['user']; // The data of logged-in user\necho $res['token']; // The token of logged-in user\n```\n\n### **Get user info**\n\n```php\n$res = $kontenbase-\u003eauth-\u003euser();\n\necho $res['user'];\n```\n\n### **Update user info**\n\n```php\n$res = $kontenbase-\u003eauth-\u003eupdate([\n\t'firstName' =\u003e 'Ega'\n]);\n\necho $res['user'];\n```\n\n### **Logout**\n\n```php\n$res = $kontenbase-\u003eauth-\u003elogout();\n```\n\n## Database\n\n### **Create a new record**\n\n```php\n$res = $kontenbase-\u003eservice('posts')-\u003ecreate([\n\t'name' =\u003e 'Post 1',\n\t'notes' =\u003e 'Hello Kontenbase'\n]);\n\necho $res['data'] // The data of the new record\n```\n\n### **Get a record by ID**\n\n```php\n$res = $kontenbase-\u003eservice('posts')-\u003egetById('605a251d7b8678bf6811k3b1');\n\necho $res['data'] // The data of the record\n```\n\n### Find records\n\n**Get all records**\n\n```php\n$res = $kontenbase-\u003eservice('posts')-\u003efind();\n\necho $res['data'] // The data of all records\n```\n\n**Find records and modify the result**\n\n```php\n// limit\n$res = $kontenbase-\u003eservice('posts')-\u003efind([\n\t'limit' =\u003e 10\n]);\n```\n\n```php\n// sort\n// ascending: 1\n// descending: -1\n$res = $kontenbase-\u003eservice('posts')-\u003efind([\n\t'sort' =\u003e ['name' =\u003e 1]\n]);\n```\n\n```php\n// skip\n$res = $kontenbase-\u003eservice('posts')-\u003efind([\n\t'skip' =\u003e 10\n]);\n```\n\n```php\n// select\n$res = $kontenbase-\u003eservice('posts')-\u003efind([\n\t'select' =\u003e ['name', 'notes']\n]);\n```\n\n```php\n// lookup all fields\n$res = $kontenbase-\u003eservice('posts')-\u003efind([\n\t'lookup' =\u003e '*'\n]);\n\n// lookup spesific fields\n$res = $kontenbase-\u003eservice('posts')-\u003efind([\n\t'lookup' =\u003e ['categories']\n]);\n\n// lookup but only show ids\n$res = $kontenbase-\u003eservice('posts')-\u003efind([\n\t'lookup' =\u003e ['_id' =\u003e '*']\n]);\n```\n\n**Find records with criteria**\n\n```php\n// equals\n$res = $kontenbase-\u003eservice('posts')-\u003efind([\n\t'where' =\u003e [\n\t\t'name' =\u003e 'Ega'\n\t]\n]);\n```\n\n```php\n// does not equal\n$res = $kontenbase-\u003eservice('posts')-\u003efind([\n\t'where' =\u003e [\n\t\t'name' =\u003e ['$ne' =\u003e 'Ega']\n\t]\n]);\n```\n\n```php\n// contains\n$res = $kontenbase-\u003eservice('posts')-\u003efind([\n\t'where' =\u003e [\n\t\t'notes' =\u003e ['$contains' =\u003e 'hello']\n\t]\n]);\n```\n\n```php\n// does not contain\n$res = $kontenbase-\u003eservice('posts')-\u003efind([\n\t'where' =\u003e [\n\t\t'notes' =\u003e ['$notContains' =\u003e 'hello']\n\t]\n]);\n```\n\n```php\n// matches any of\n$res = $kontenbase-\u003eservice('posts')-\u003efind([\n\t'where' =\u003e [\n\t\t'name' =\u003e ['$in' =\u003e ['Ega', 'Radiegtya']]\n\t]\n]);\n```\n\n```php\n// does not match any of\n$res = $kontenbase-\u003eservice('posts')-\u003efind([\n\t'where' =\u003e [\n\t\t'name' =\u003e ['$nin' =\u003e ['Ega', 'Radiegtya']]\n\t]\n]);\n```\n\n```php\n// less than\n$res = $kontenbase-\u003eservice('posts')-\u003efind([\n\t'where' =\u003e [\n\t\t'total' =\u003e ['$lt' =\u003e 10]\n\t]\n]);\n```\n\n```php\n// less than or equals\n$res = $kontenbase-\u003eservice('posts')-\u003efind([\n\t'where' =\u003e [\n\t\t'total' =\u003e ['$lte' =\u003e 10]\n\t]\n]);\n```\n\n```php\n// more than\n$res = $kontenbase-\u003eservice('posts')-\u003efind([\n\t'where' =\u003e [\n\t\t'total' =\u003e ['$gt' =\u003e 10]\n\t]\n]);\n```\n\n```php\n// more than or equals\n$res = $kontenbase-\u003eservice('posts')-\u003efind([\n\t'where' =\u003e [\n\t\t'total' =\u003e ['$gte' =\u003e 10]\n\t]\n]);\n```\n\n### Update record\n\n```php\n$res = $kontenbase-\u003eservice('posts')-\u003eupdateById('605a251d7b8678bf6811k3b1', [\n\t'notes' =\u003e 'Hello world'\n]);\n```\n\n### Delete record\n\n```php\n$res = $kontenbase-\u003eservice('posts')-\u003edeleteById('605a251d7b8678bf6811k3b1');\n```\n\n### Link a record to create relation\n\n```php\n$res = $kontenbase-\u003eservice('posts')-\u003elink('605a251d7b8678bf6811k3b1', [\n\t'categories' =\u003e '61d26e8e2adb12b85c33029c'\n]);\n```\n\n### Unlink a record from its relation\n\n```php\n$res = $kontenbase-\u003eservice('posts')-\u003eunlink('605a251d7b8678bf6811k3b1', [\n\t'categories' =\u003e '61d26e8e2adb12b85c33029c'\n]);\n```\n\n### Count total records\n\n**Count all records**\n\n```php\n$res = $kontenbase-\u003eservice('posts')-\u003ecount();\n```\n\n**Count records that match given criteria**\n\n```php\n$res = $kontenbase-\u003eservice('posts')-\u003efind([\n\t'where' =\u003e [\n\t\t'name' =\u003e 'Ega'\n\t]\n]);\n```\n\n## Storage\n\n### Upload a file\n```php\n$file = fopen('/path/to/file', 'r');\n$res = $kontenbase-\u003estorage-\u003eupload($file);\n\necho $res['data'] // The data of the uploaded file\n```\n\n## Feedback\n\nPlease use our [GitHub Issues](https://github.com/kontenbase/feedback) for high-level feedback. Also you can join our [Discord server](https://a.kontenbase.com/discord).","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkontenbase%2Fkontenbase-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkontenbase%2Fkontenbase-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkontenbase%2Fkontenbase-php/lists"}