{"id":13660220,"url":"https://github.com/5am-code/laravel-notion-api","last_synced_at":"2025-05-14T15:00:27.193Z","repository":{"id":40777184,"uuid":"367348616","full_name":"5am-code/laravel-notion-api","owner":"5am-code","description":"Effortless Notion integrations with Laravel","archived":false,"fork":false,"pushed_at":"2025-03-05T07:56:40.000Z","size":671,"stargazers_count":429,"open_issues_count":9,"forks_count":50,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-04-15T08:45:32.115Z","etag":null,"topics":["api","effortless-notion-integrations","laravel","notion","notion-api","notion-integration","notion-sdk","php","php-notion"],"latest_commit_sha":null,"homepage":"https://notionforlaravel.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/5am-code.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","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},"funding":{"github":null,"patreon":"5amcode","open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2021-05-14T11:58:55.000Z","updated_at":"2025-04-07T20:44:24.000Z","dependencies_parsed_at":"2024-01-07T21:45:27.808Z","dependency_job_id":"4f23a39b-1ca2-4b92-8426-a97fc11557fb","html_url":"https://github.com/5am-code/laravel-notion-api","commit_stats":{"total_commits":163,"total_committers":9,"mean_commits":18.11111111111111,"dds":0.4785276073619632,"last_synced_commit":"1e259ffb7ef52b31a8f4116695cd77ac7fae2676"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/5am-code%2Flaravel-notion-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/5am-code%2Flaravel-notion-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/5am-code%2Flaravel-notion-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/5am-code%2Flaravel-notion-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/5am-code","download_url":"https://codeload.github.com/5am-code/laravel-notion-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254168084,"owners_count":22026080,"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":["api","effortless-notion-integrations","laravel","notion","notion-api","notion-integration","notion-sdk","php","php-notion"],"created_at":"2024-08-02T05:01:18.730Z","updated_at":"2025-05-14T15:00:27.066Z","avatar_url":"https://github.com/5am-code.png","language":"PHP","readme":"\u003ch1 align=\"center\"\u003e Notion for Laravel\u003c/h1\u003e\n\n\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"https://notionforlaravel.com/images/open-graph.png\" alt=\"Notion For Laravel\" width=\"500\"\u003e\n\n[![Run tests](https://github.com/5am-code/laravel-notion-api/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/5am-code/laravel-notion-api/actions/workflows/main.yml)\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/fiveam-code/laravel-notion-api.svg?style=flat-square)](https://packagist.org/packages/fiveam-code/laravel-notion-api)\n[![Total Downloads](https://img.shields.io/packagist/dt/fiveam-code/laravel-notion-api.svg?style=flat-square)](https://packagist.org/packages/fiveam-code/laravel-notion-api)\n\n[comment]: \u003c\u003e (![GitHub Actions]\u0026#40;https://github.com/fiveam-code/laravel-notion-api/actions/workflows/main.yml/badge.svg\u0026#41;)\n\u003c/div\u003e\nThis package provides a simple and crisp way to access the Notion API endpoints, query data and update existing entries.\n\n# Documentation\n\nFor a extensive documentation, more context and usage examples, head over to the official documentation at [notionforlaravel.com](https://notionforlaravel.com).\n\n\n# Quick Start Guide\n\nAll examples refer to our test database, which you can\nfind [here](https://dianawebdev.notion.site/8284f3ff77e24d4a939d19459e4d6bdc?v=bc3a9ce8cdb84d3faefc9ae490136ac2).\n\n## Installation\n\nThe package is compatible with Laravel 8, 9 and 10. The minimum PHP requirement is 8.0.\n\n1. Install the package via composer:\n\n   ```bash\n   composer require fiveam-code/laravel-notion-api\n   ```\n\n2. Get your Notion API access token like explained in [their documentation](https://developers.notion.com/). It's also\n   important to grant access to the integration within your Notion pages, which is described in the developer\n   documentation at Notion as well.\n\n3. Add a new line to your applications `.env` file:\n\n   ```bash\n   NOTION_API_TOKEN=\"$YOUR_ACCESS_TOKEN\"\n   ```\n\n4. You're ready to go! You can now access Notion endpoints through the `Notion` facade:\n\n   ```php\n   use \\Notion;\n\n   Notion::databases()-\u003efind(\"8284f3ff77e24d4a939d19459e4d6bdc\");\n   ```\n\n   That's it.\n\nFor detailed usage information and a list of available endpoints see (the docs).\n\n## Examples\n\n\n### Fetch a Notion Database\n\nThe `databases()-\u003efind()` method returns a `FiveamCode\\LaravelNotionApi\\Entities\\Database` object,\nwhich contains all the information about the database, including its properties and the possible values for each\nproperty.\n\n```php\nuse \\Notion;\n\nNotion::databases()\n        -\u003efind(\"8284f3ff77e24d4a939d19459e4d6bdc\");\n```\n\n### Fetch a Notion Page\n\nThe `pages()-\u003efind()` method returns a `FiveamCode\\LaravelNotionApi\\Entities\\Page` object,\nwhich contains all the information about the page, including its properties and the possible values for each property.\n\n```php\nNotion::pages()\n        -\u003efind(\"e7e5e47d-23ca-463b-9750-eb07ca7115e4\");\n```\n\n### Search\n\nThe `search()` endpoint returns a collection of pages that match the search query. The scope of the search is limited to\nthe workspace that the integration is installed in\nand the pages that are shared with the integration.\n\n```php\nNotion::search(\"Search term\")\n        -\u003equery()\n        -\u003easCollection();\n```\n\n### Query Database\n\nThe `database()` endpoint allows you to query a specific database and returns a collection of pages (= database\nentries).\nYou can filter and sort the results and limit the number of returned entries. For detailed information about the\navailable\nfilters and sorts, please refer to the [documentation](https://developers.notion.com/reference/post-database-query).\n\n```php\nuse FiveamCode\\LaravelNotionApi\\Query\\Filters\\Filter;\nuse FiveamCode\\LaravelNotionApi\\Query\\Filters\\Operators;\n\n$nameFilter = Filter::textFilter('Name', Operators::EQUALS, 'Ada Lovelace');\n\n\\Notion::database(\"8284f3ff77e24d4a939d19459e4d6bdc\")\n    -\u003efilterBy($nameFilter)\n    -\u003elimit(5)\n    -\u003equery()\n    -\u003easCollection();\n```\n\nCompound filters for AND or OR queries are also available:\n\n```php\nuse Illuminate\\Support\\Collection;\nuse FiveamCode\\LaravelNotionApi\\Query\\Filters\\Filter;\nuse FiveamCode\\LaravelNotionApi\\Query\\Filters\\FilterBag;\nuse FiveamCode\\LaravelNotionApi\\Query\\Filters\\Operators;\nuse FiveamCode\\LaravelNotionApi\\Query\\Sorting;\n\n# Give me all entries that are\n# (KnownFor == UNIVAC || KnownFor == ENIAC)\n# and sort them by name ascending\n\n$filterBag = new FilterBag(Operators::AND);\n\n$filterBag-\u003eaddFilter(\n    Filter::rawFilter(\"Known for\", [\n        \"multi_select\" =\u003e [Operators::CONTAINS =\u003e \"UNIVAC\"],\n    ])\n);\n\n$filterBag-\u003eaddFilter(\n    Filter::rawFilter(\"Known for\", [\n        \"multi_select\" =\u003e [Operators::CONTAINS =\u003e \"ENIAC\"],\n    ])\n);\n\n\\Notion::database(\"8284f3ff77e24d4a939d19459e4d6bdc\")\n    -\u003efilterBy($filterBag)\n    -\u003esortBy(Sorting::propertySort('Name', 'ascending'))\n    -\u003elimit(5)\n    -\u003equery()\n    -\u003easCollection();\n```\n\n### Tests\n\nYou can find even more usage examples by checking out the package tests in the `/tests` directory.\nWe are using [Pest](https://pestphp.com/) for out tests and are currently in the process of switching all existing PHPUnit tests to Pest.\n\nIf you want to run the tests in your CLI:\n\n```bash\nvendor/bin/pest tests\n```\n\n# Support\n\n## Supported by Tinkerwell\n\n\u003ca href=\"https://tinkerwell.app/\"\u003e\n\u003cimg src=\"https://tinkerwell.app/images/tinkerwell_logo.png\" width=\"64\" height=\"64\" alt=\"Tinkerwell\"\u003e \u003cbr/\u003e\n\u003c/a\u003e\n\nThe development of this package is supported by [Tinkerwell](https://tinkerwell.app/).\n\n\n# Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n# Security\n\nIf you discover any security related issues, please email hello@dianaweb.dev instead of using the issue tracker.\n\n# Credits\n\n- [Diana Scharf](https://github.com/mechelon)\n- [Johannes Güntner](https://github.com/johguentner)\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://5amco.de/images/5am.png\" width=\"200\" height=\"200\"\u003e\n\u003c/p\u003e\n\n# License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","funding_links":["https://patreon.com/5amcode"],"categories":["PHP","APIs"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F5am-code%2Flaravel-notion-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F5am-code%2Flaravel-notion-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F5am-code%2Flaravel-notion-api/lists"}