Skip to content
This repository has been archived by the owner on Oct 6, 2022. It is now read-only.

storyblok/silex-boilerplate

Repository files navigation

silex-boilerplate using Storyblok

A Storyblok boilerplate in php with silex to kickstart your website.



GitHub release

What is a Storyblok boilerplate?

If you want to use your server or have already an existing project in which you want to integrate Storyblok you can use one of the Storyblok boilerplates.

How to start with a boilerplate?

The most efficient way to start a Storyblok project as a developer would be with the Command Line Interface.

npm i storyblok -g
storyblok

and choose your boilerplate. You can of course simply download or clone this repository as well.

git clone https://github.com/storyblok/silex-boilerplate

Configuration

In the webapp/config.php all you need to change is the STORYBLOK_CONFIGURATION - by adding your space information. What is a Space?:

$app['config.home']             = 'home'; #change this to your home story slug
$app['storyblok.privateToken']  = 'Iw3XKcJb6MwkdZEwoQ9BCQtt'; #change this to your private key.

Start your local environment

Make sure Composer and npm are installed:

## Install PHP dependencies.
composer install

## Install all frontend development related dependencies.
npm install

## This will start up a php server on :4040 and a proxy for browsersync on :4200. 
gulp

Folder structure

  • /app/ The place where you should put all your scripts, styles source code - you can also add your images here but make sure to add a gulp task which copies that to the public folder.
  • /webapp/ The php application using silex and our client library.
  • /webapp/views/ All your layouts and components at one space - if you add a new or change an existing Twig component (.twig) the gulp build will trigger an instant reload for you in the browser - also each component is a representation of a storyblok component. If you create a headline component in storyblok - make sure to create a headline.twig as well - so this application knows which component to render.
  • /public/ Once you run gulp the app source files will be prepared (prefixed, minified, uglified, ...) and copied to the /public/ folder for delivery.
  • /cache/ Our client library directly adds a file cache (you can change this setting as well) for every storyblok request you do - this folder is the place where we save the cached results.

You want to know more about Storyblok?

How to install composer?

php -r "readfile('https://getcomposer.org/installer');" | php
sudo mkdir /usr/local/bin/
sudo mv composer.phar /usr/local/bin/composer


Storyblok Logo