# Bookmark API

> For the complete documentation index, see [llms.txt](https://doc.ibexa.co/en/6.0/llms.txt).

You can use the PHP API to view the favourites list, and add or remove content from it.

[`BookmarkService`](https://doc.ibexa.co/en/6.0/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-BookmarkService.html) enables you to add and remove content from favourites, and read favourite assignments.

> **Tip: Bookmark REST API**
>
> To learn how to manage favourites using the REST API, see [REST API reference](https://doc.ibexa.co/en/6.0/api/rest_api/rest_api_reference/rest_api_reference.html#tag/Bookmark).

To view a list of all favourites, use [`BookmarkService::loadBookmarks`](https://doc.ibexa.co/en/6.0/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-BookmarkService.html#method_loadBookmarks):

```php
$bookmarkList = $this->bookmarkService->loadBookmarks();

$output->writeln('Total favourites: ' . $bookmarkList->totalCount);

foreach ($bookmarkList->items as $bookmark) {
    $output->writeln($bookmark->getContentInfo()->name);
}
```

You can mark a content item as favourite by providing its Location object to the [`BookmarkService::createBookmark`](https://doc.ibexa.co/en/6.0/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-BookmarkService.html#method_createBookmark) method:

```php
$location = $this->locationService->loadLocation($locationId);

$this->bookmarkService->createBookmark($location);
```

You can remove a location from a list of favourites with [`BookmarkService::deleteBookmark`](https://doc.ibexa.co/en/6.0/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-BookmarkService.html#method_deleteBookmark):

```php
$this->bookmarkService->deleteBookmark($location);
```
