Download the PHP package sensiolabs-de/storyblok-api without Composer
On this page you can find all versions of the php package sensiolabs-de/storyblok-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package storyblok-api
storyblok-api
Branch | PHP | Code Coverage |
---|---|---|
master |
Symfony
Use the symfony bundle sensiolabs-de/storyblok-bundle to integrate this library into your Symfony application.
Usage
Installation
Setup
Spaces
In your code you should type-hint to SensioLabs\Storyblok\Api\SpacesApiInterface
Get the current space
Returns the space associated with the current token.
Stories
In your code you should type-hint to SensioLabs\Storyblok\Api\StoriesApiInterface
Get all available stories
Fetch by Version (draft
, published
)
Global
Method Call
Pagination
Sorting
Filtering
Available filters
AllInArrayFilter.php
Example:
AnyInArrayFilter.php
Example:
GreaterThanDateFilter.php
Example:
LessThanDateFilter.php
Example:
GreaterThanFloatFilter.php
Example:
LessThanFloatFilter.php
Example:
GreaterThanIntFilter.php
Example:
LessThanIntFilter.php
Example:
InFilter.php
Example:
NotInFilter.php
Example:
IsFilter.php
Example:
LikeFilter.php
Example:
NotLikeFilter.php
Example:
OrFilter.php
Example:
Get all available stories by Content Type (string
)
Get by uuid (SensioLabs\Storyblok\Api\Domain\Value\Uuid
)
Get by slug (string
)
Get by id (SensioLabs\Storyblok\Api\Domain\Value\Id
)
Links
In your code you should type-hint to SensioLabs\Storyblok\Api\LinksApiInterface
Get all available links
Pagination
Get by parent (SensioLabs\Storyblok\Api\Domain\Value\Id
)
Get all root links
Datasource
In your code you should type-hint to SensioLabs\Storyblok\Api\DatasourceApiInterface
Get by name (string
)
If it has more than one dimension, you can get the entries by
Tags
In your code you should type-hint to SensioLabs\Storyblok\Api\TagsApiInterface
Get all available tags
Assets
To use the assets API you have to configure the Assets client.
DX Enhancement through Abstract Collections
To improve developer experience (DX), especially when working with content types like stories, the following abstract class is provided to manage collections of specific content types. This class simplifies data handling and ensures type safety while dealing with large amounts of content from Storyblok.
Abstract ContentTypeCollection Class
The ContentTypeCollection class provides a structured way to work with Storyblok content types. It makes managing pagination, filtering, and sorting more intuitive and reusable, saving time and reducing boilerplate code.
Benefits of Using the Abstract Collection:
- Simplified Data Handling: Instead of dealing with raw arrays of stories, this abstract class helps you manage collections of content types, like blog posts or articles, in an organized manner. It abstracts away the repetitive work of pagination and mapping response data to objects.
- Enhanced Readability: Using a well-structured collection class makes the code easier to read and maintain. Instead of handling pagination and raw data structures in controllers or services, you simply instantiate the collection and let it handle the data.
- Reusability: The class is flexible and reusable across different content types. Once implemented, you can easily create new collections for other Storyblok content types with minimal extra code.
- Pagination and Metadata Management: The collection class comes with built-in properties for pagination and metadata (e.g., total items, current page, etc.), making it much easier to manage paginated data efficiently.
Example Usage with a Collection
Here is an example of how to use the ContentTypeCollection to manage blog posts in your Symfony project:
All versions of storyblok-api with dependencies
oskarstark/enum-helper Version ^1.5
oskarstark/trimmed-non-empty-string Version ^1.1
psr/log Version ^3.0
symfony/cache Version ^7.0
symfony/cache-contracts Version ^3.5
symfony/http-client Version ^6.0 || ^7.0
thecodingmachine/safe Version ^2.0
webmozart/assert Version ^1.11