Search by

tuxonice / storyblok-transfers

tuxonice

Generate PHP transfer objects from your Storyblok components, and read stories from the Content Delivery API straight into them

v0.4.0 2026-11-10 15:23 UTC

This package is auto-updated.

Last update: 2026-11-10 16:07:43 UTC


README

CI Packagist PHP License

Typed PHP objects for your Storyblok content, in any framework.

  • Generate a PHP transfer class for every component in your Storyblok space.
  • Read stories from the Content Delivery API straight into those classes, with relations, drafts, languages, links and datasources.
Storyblok space ──generate──▶ PageTransfer, HeroTransfer, …
Storyblok story ──read──────▶ $story->getContent()  // PageTransfer

Installation

composer require tuxonice/storyblok-transfers

Requires PHP 8.3+.

In short

# Generate classes from your space's components
STORYBLOK_SPACE_ID=290156928914344 \
STORYBLOK_MANAGEMENT_TOKEN=your-personal-access-token \
vendor/bin/generate
use App\DataTransferObjects\PageTransfer;
use Tlab\StoryblokTransfers\Content\StoryblokContent;

// Reads STORYBLOK_DELIVERY_TOKEN from the environment
$storyblok = StoryblokContent::fromEnvironment();

$story = $storyblok->stories()->bySlug('home', PageTransfer::class);

echo $story?->getContent()->getTitle();   // a typed PageTransfer

Start with Getting started, which walks through this from an empty project.

Documentation

What's changed: CHANGELOG.md. Working on the package itself? See CONTRIBUTING.md.

License

MIT. See LICENSE.