Skip to content

Commit c8be31c

Browse files
authored
polish introduction, header and examples
- currently only polished existing examples - updated test command - move 5amcode logo to credits
1 parent 2f75bbd commit c8be31c

File tree

1 file changed

+44
-48
lines changed

1 file changed

+44
-48
lines changed

README.md

Lines changed: 44 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
<h1 align="center"> Laravel Notion API</h1>
2-
<h2 align="center"> Effortless Notion integrations with Laravel</h2>
1+
<h1 align="center"> Notion for Laravel</h1>
32

4-
<p align="center">
5-
<img src="https://5amco.de/images/5am.png" width="200" height="200">
6-
</p>
3+
<img src="https://banners.beyondco.de/Notion%20for%20Laravel.png?theme=light&packageManager=composer+require&packageName=fiveam-code%2Flaravel-notion-api&pattern=architect&style=style_1&description=Effortless+Notion+integrations+with+Laravel&md=1&showWatermark=1&fontSize=100px&images=https%3A%2F%2Flaravel.com%2Fimg%2Flogomark.min.svg">
74

85
[![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)
96
[![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)
@@ -12,52 +9,58 @@
129

1310
This package provides a simple and crisp way to access the Notion API endpoints, query data and update existing entries.
1411

12+
1513
## Installation
1614

17-
You can install the package via composer:
15+
1. You can install the package via composer:
1816

19-
```bash
20-
composer require fiveam-code/laravel-notion-api
21-
```
17+
```bash
18+
composer require fiveam-code/laravel-notion-api
19+
```
2220

23-
### Authorization
2421

25-
The Notion API requires an access token and a Notion integration, [the Notion documentation](https://developers.notion.com/docs/getting-started#before-we-begin) explains how this works. It's important to grant access to the integration within your Notion account to enable the API access.
22+
2. Get your Notion API access token like explained in [their documentation](https://developers.notion.com/). It's also
23+
important to grant access to the integration within your Notion pages, which is described in the developer documentation at Notion as well.
2624
27-
Add your Notion API token to your `.env` file:
25+
3. For internal Integrations, please add a new entry to your `.env` like the following:
26+
27+
```bash
28+
NOTION_API_TOKEN="$YOUR_ACCESS_TOKEN"
29+
```
30+
4. Now you can easily access Notion:
31+
```php
32+
use \Notion;
33+
34+
Notion::databases()->find($databaseId);
35+
```
36+
37+
That's it.
2838

29-
```
30-
NOTION_API_TOKEN="$YOUR_ACCESS_TOKEN"
31-
```
3239

3340
## Usage
3441

35-
Head over to the [Documentation](https://5amco.de/docs) of this package.
42+
Head over to the [Documentation](https://notionforlaravel.com) of this package.
3643

37-
### 🔥 Code Examples to jumpstart your Notion API Project
44+
### 🔥 Code Examples to jumpstart your next Notion API Project
3845

39-
#### Basic Setup (+ example)
46+
#### Fetch a Notion Database (through a Facade)
4047
```php
41-
use FiveamCode\LaravelNotionApi\Notion;
48+
use \Notion;
4249
43-
# Access through Facade (token has to be set in .env)
44-
\Notion::databases()->find($databaseId);
45-
46-
# Custom instantiation (necessary if you want to access more than one NotionApi integration)
47-
$notion = new Notion($apiToken, $apiVersion); // version-default is 'v1'
48-
$notion->databases()->find($databaseId);
50+
Notion::databases()
51+
->find("a7e5e47d-23ca-463b-9750-eb07ca7115e4");
4952
```
5053

51-
#### Fetch Page Information
54+
#### Fetch a Notion Page
5255
```php
53-
// Returns a specific page
54-
\Notion::pages()->find($yourPageId);
56+
Notion::pages()
57+
->find("e7e5e47d-23ca-463b-9750-eb07ca7115e4");
5558
```
5659

5760
#### Search
5861
```php
5962
// Returns a collection pages and databases of your workspace (included in your integration-token)
60-
\Notion::search($searchText)
63+
Notion::search("My Notion Search")
6164
->query()
6265
->asCollection();
6366
```
@@ -69,18 +72,14 @@ $notion->databases()->find($databaseId);
6972
$sortings = new Collection();
7073
$filters = new Collection();
7174
72-
$sortings
73-
->add(Sorting::propertySort('Ordered', 'ascending'));
74-
$sortings
75-
->add(Sorting::timestampSort('created_time', 'ascending'));
75+
$sortings->add(Sorting::propertySort('Ordered', 'ascending'));
76+
$sortings->add(Sorting::timestampSort('created_time', 'ascending'));
7677
77-
$filters
78-
->add(Filter::textFilter('title', ['contains' => 'new']));
78+
$filters->add(Filter::textFilter('title', ['contains' => 'new']));
7979
// or
80-
$filters
81-
->add(Filter::rawFilter('Tags', ['multi_select' => ['contains' => 'great']]));
80+
$filters->add(Filter::rawFilter('Tags', ['multi_select' => ['contains' => 'great']]));
8281
83-
\Notion::database($yourDatabaseId)
82+
Notion::database("a7e5e47d-23ca-463b-9750-eb07ca7115e4")
8483
->filterBy($filters) // filters are optional
8584
->sortBy($sortings) // sorts are optional
8685
->limit(5) // limit is optional
@@ -89,10 +88,10 @@ $filters
8988
```
9089
9190
92-
### Testing
91+
### Testing (pestphp)
9392
9493
```bash
95-
vendor/bin/phpunit tests
94+
vendor/bin/pest tests
9695
```
9796
9897
## Support
@@ -107,19 +106,16 @@ Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
107106
108107
If you discover any security related issues, please email hello@dianaweb.dev instead of using the issue tracker.
109108
110-
## Used By
111-
112-
- Julien Nahum created [notionforms.io](https://notionforms.io) with [laravel-notion-api](https://github.com/5am-code/laravel-notion-api), which allows you to easily create custom forms, based on your selected database within notion.
113-
- [GitHub Notion Sync](https://githubnotionsync.com/), a service by [Beyond Code](https://beyondco.de) to sync the issues of multiple GitHub repositories into a Notion database
114-
- [Notion Invoice](https://notioninvoice.com/), the first premium invoicing solution for freelancers and businesses that use Notion. Create beautiful PDF invoices from your Notion data.
115-
116-
Using this package in your project? Open a PR to add it in this section!
117-
118109
## Credits
119110
120111
- [Diana Scharf](https://github.com/mechelon)
121112
- [Johannes Güntner](https://github.com/johguentner)
122113
114+
115+
<p align="center">
116+
<img src="https://5amco.de/images/5am.png" width="200" height="200">
117+
</p>
118+
123119
## License
124120
125121
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

0 commit comments

Comments
 (0)