Scenic Views with PHP

Scenic View is a tiny library that provides view and template inheritance. The syntax is straight PHP but is very clean and expressive.

The following examples use PHP short syntax (to provide cleaner views) which is fine if you have control over your own server. NOTE: you should definitely use <?php ?> if you are planning to distribute your code or do not have admin access to your server.

Loading and Rendering a View

View Inheritance and Templating


Create a layout (template) file that other files will extend. The $show() method displays a section of content that’s defined by a child view extending it.


Create your view that extends the layout and provides the content for the section.

Extending Parent’s Content

What if you want to provide content in the parent, but extend that in the child? You can!

Define a section in the template.

Use the @parent key in the view to specify where you want the parent content to appear.



Including partial views, like headers or footers, is easy as well.

Download & Install

You can download Scenic views directly from the Github repository, or if you use composer through Packagist.

View on Github →

View on Packagist →

Install using Composer

If you are not already using composer to manage your dependencies I highly recommend reading up on it as soon as you get a chance!

Just add the following to your composer.json file:


If you have any questions, comments or suggestions please post them below. If you find any issues please report them on Github.