At Storyblok, we firmly believe in PHP and the power of open source software. Both have shaped the web as we know it today and continue to be crucial in its evolution.
That's why we're thrilled to announce that long with our partners SensioLabs, creators of Symfony, we've completely rebuilt our PHP packages from the ground up.
This collaboration represents more than just an update. It's a complete re-imagining on how PHP developers can interact with Storyblok. By working with SensioLabs, we've ensured these new packages adhere to modern practices, offer excellent Symfony support, and provide a significantly improved developer experience.
Today, we're announcing four brand-new PHP packages designed to make integrating Storyblok into your projects seamlessly.
Our previous PHP client and associated packages will be deprecated as we move forward with these improved solutions.
Let's explore each package and what it brings to the table.
Content Delivery API Client
The Content Delivery API Client is a type-safe PHP SDK designed to retrieve content from Storyblok. It provides an elegant way to interact with your Storyblok space, with built-in support for fetching stories, links, datasources, tags, and assets.
Use this client to easily fetch content for your project:
use Storyblok\Api\StoriesApi;
use Storyblok\Api\StoryblokClient;
use Storyblok\Api\Request\StoryRequest;
$client = new StoryblokClient(
baseUri: '<https://api.storyblok.com>',
token: 'your_storyblok_token'
);
$storiesApi = new StoriesApi($client);
$response = $storiesApi->bySlug('folder/slug', new StoryRequest(
language: 'de',
));
More advanced features like filtering, pagination, and sorting, are also supported, giving you precise control over the data.
Symfony Bundle
The Storyblok Symfony Bundle takes integration to the next level for Symfony applications. Developed in direct collaboration with SensioLabs, it leverages the Content Delivery API Client while adding Symfony-specific features like automatic client configuration and Symfony Profiler integration.
Get started by adding these lines to your config/packages/storyblok.yaml
file:
storyblok:
base_uri: '%env(STORYBLOK_API_BASE_URI)%'
token: '%env(STORYBLOK_API_TOKEN)%'
With this minimal setup, the bundle handles all the configuration, allowing you to immediately inject and use Storyblok's APIs within your controllers and services.
The bundle also handles environment-specific configuration, making it easy to switch between development and production environments.
Management API Client
The Management API Client allows you to programmatically manage your Storyblok content, providing you with a comprehensive set of tools for creating, updating, and organizing content within your spaces.
This client simplifies complex content management tasks with an intuitive API:
use Storyblok\ManagementApi\ManagementApiClient;
use Storyblok\ManagementApi\Endpoints\StoryApi;
use Storyblok\ManagementApi\Data\Story;
use Storyblok\ManagementApi\Data\StoryComponent;
$client = new ManagementApiClient($accessToken);
$storyApi = new StoryApi($client, $spaceId);
$content = new StoryComponent("article-page");
$content->set("title", "New Article");
$content->set("body", "This is the content");
$story = new Story(
"An Article",
"an-article-slug",
$content
);
$storyCreated = $storyApi->create($story)->data();
echo "Story created, ID: " . $storyCreated->id();
This package is especially valuable for content migration, bulk operations, and building custom editorial workflows.
PHP Tiptap Extension
The PHP Tiptap Extension provides an extension specifically designed for Storyblok's rich text fields processing.
This framework-agnostic package makes rendering rich text fields from Storyblok straightforward and flexible in any PHP project, whether you're using Symfony, Laravel, or any other PHP framework.
You can easily transform Storyblok's rich text content into HTML with customizable rendering:
use Tiptap\Editor;
use Storyblok\Tiptap\Extension\Storyblok;
$editor = new Editor([
'extensions' => [
new Storyblok(),
],
]);
$editor->setContent(...); // Content from your API
echo $editor->getHTML();
It also allows you to provide your own Block renderer, and it is included in our Symfony Bundle package.
With all these releases comes a renewed PHP Technology Hub in our official website, a starting point for all your future integrations between your PHP projects and Storyblok.
Important note about legacy packages
As part of this launch, the following PHP packages are now entering a deprecation phase:
- storyblok/php-client (our original PHP Client)
- storyblok/storyblok-php-richtext-renderer (for handling richtext fields)
If your current projects use these packages, don't worry, they will continue to work.
That said, we strongly encourage all users to move to these new solutions, which offer significant advantages including modern PHP 8+ features, better type safety, and extensive testing.
We'll be providing migration guides to help with the transition. Support for legacy packages will continue in the meantime, but all new features will exclusively target these new packages.
The future ahead
These packages represent a renewed commitment to the PHP ecosystem and the open source community, and we want to express our sincere gratitude to SensioLabs for their expertise and collaboration in this endeavor.
This release is just the beginning. We're actively working on expanding our PHP support and have exciting plans for the future (to our Laravel users: stay tuned!.
We invite our wonderful community to try these packages, provide feedback, and contribute to their ongoing development. Get involved at Storyblok Community!
Top comments (0)