Staying out of the control panel

  • Hello,

    One of the things I love about Perch is I don't have to go to the control panel to get things done. Examples:

    • Perch templates define the content schema - I don't need to do that via the control panel
    • perch_content_create() allows me to create a region with some default options

    A part of me wishes I could achieve more from the code editor without having to log into the control panel.

    Although Collections is a big selling point of Runway, you have to create a Collection via a control panel. It would be nice if we can create Collections and set some default options (template, item URL, sort by, sort order, etc) from a file e.g. /perch/config/collections.php.

    Another big feature in Runway is Routing, yet you also have to add them via the control panel. Not sure how feasible this would be, but if given the option, I would prefer to register routes from the master page templates:

    1. PerchSystem::register_page_route('services/[slug:s]');

    Or from a single file:


    Managing these settings/options from the codebase would enable us to version control them.

    This would also make working in teams with other developers smoother. I end up having to add these settings locally and on staging to make them accessible to other developers. Developers still have to copy those to their local environments (of course they will miss something) or at least download the database from staging (it can overwrite what they were working on).

    When it comes to routes, it would be a lot easier to add multiple URL patterns in one go to a file instead of adding one, save it, add another, save, etc. A client site has now ~50 URL patterns.

    These are just thoughts. Perhaps others don't agree with me. Perhaps it's not practical to change the current implementation. Or perhaps this is already addressed in v4?

  • I agree, i love to automate things . so being able to create a script that would programatically setup a basic site and allow me to choose what i need for that specific site would be the type of thing i would create. It would be awesome if the API was more of a REST Api which allowed full control over the different resources in the system.

  • I have always wondered why I couldn't use a similar principle to creating regions via code. It always catches me out when I use standard Perch for ages then go to do a Runway site. I am quite sure I've even typed

    1. perch_collection_create

    before realizing my mistake.

    Programatically creating a collection would save a lot of work, for me at least.

  • One of the original design goals with Perch has always been to make as much as possible configured via the control panel rather than in code. The reasoning is that we were targeting Perch as a system that enabled less developer-focussed users to build things. This is why things like the settings and the region options are all configured in the control panel and not in code.

    That was 10 years ago, however, and things have changed quite a bit since then. So perhaps it’s time to re-evaluate that approach. It would certainly be useful to have routes configured in code, I agree. There’s little more annoying that deploying a site change and then having to manually copy the routes across.