Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.

Latest commit

 

History

History
62 lines (42 loc) · 2.21 KB

README.md

File metadata and controls

62 lines (42 loc) · 2.21 KB

Silex Perch Integration

This project is a base for your Silex applications that needs Perch integration for a truly simple and friendly backend interface.

Silex is a powerful micro-framework for PHP, built on the shoulders of Symfony2. The idea is to use Silex to provide the frontend magic, while you can separate and present the robust Perch backend to your customers.

Installation

Start by cloning this repository, and install the dependencies using Composer:

git clone https://github.com/cvaldemar/Silex-Perch.git silex-perch
cd silex-perch
curl -s http://getcomposer.org/installer | php
php composer.phar install

Install a copy of Perch into vendor/perch:

unzip perch_v1.8.4.zip
mv perch_v1.8.4 silex_perch/vendor/perch

Finally, configure Perch, by creating a vendor/perch/config/config.php. If you install the backend separately or have it running already just copy config.php from that installation. If you are installing a clean Perch make sure you create the database and database tables using the perch.sql included with Perch.

Then what?

Start hacking in src/controllers.php. Create your Twig views in views/ and use the new Twig tags to initialize content from the Perch backend.

Example:

{{ perch_runtime() }}
{{ perch_location('/index') }}
<h1>{{ perch_content('Title') }}</h1>
<p>{{ perch_content('Body') }}</p>

Note: You must call perch_runtime to initialize the Perch runtime and perch_location to specify the page location. Perch will use the location to categorize content elements in the backend.

Todo

  • Develop the Twig integration further
  • Make sure Perch apps work
  • Figure out how and where to put Perch to avoid having two installations

Credits

Perch-Twig integration based on and inspired by Gavin McFarland's twig-perch-extension

Silex is brought to you by Fabien Potencier, the creator of the Symfony framework, and Igor Wiedler.

License

Licensed under the MIT license.