Help / Developer tips

Topics

Other Perch Sites

Working with a front controller

Perch is reasonably well namespaced and so can be integrated with most PHP frameworks without too much trouble. When using Perch with a Front Controller pattern (as utilised by most MVC frameworks), a downside is that Perch sees every page as the same script. Knowledge of its environment is lost.

To help address this, we've provided a mechanism for telling Perch which page it is on. The set_page() method of the static PerchSystem class can be called as below, after the Perch runtime has been included and before any content is requested.

PerchSystem::set_page('/products/fish-cakes');