Do you like working with PHP Frameworks?

I do as a personal project because it’s one area in web development that genuinely interests me, and it helps me learn the bits and bolts and how to architect complex applications, as well as experiment with my own ideas.

As for the CMS library at the moment it has made a lot of focus on making it extremely easy to build forms based in a field system and API with like 25 different field types, some of which are extensions of other fields, and they all end up extending a common field object. The code and architecture there only is quite sophisticated but reasonably so since forms are the building blocks of CMSes.

At the moment the routing happens either based in an existing node in the database that registers a URL, or in a programmatic sense through a tree directory structure that may contain different kinds of files (controllers which represent those nodes, templates, styles or scripts, and a ‘nodes’ directory which may contain other nodes).

Those node controllers define the page and what components they contain. The approach could be hybrid since a node could be defined in the database or through a controller file that follows convention.

Components (and even node controllers) may make use of data models which extend a common database object and basically represent a database table. These models are instantiated through a data model factory, and they allow to perform CRUD operations on those tables. They define in code (an array property) all the database fields and their configuration, so that the installation of database tables can happen programmatically upon initialisation of a data model.

Regarding this last point I can see how code generators could come into place there.

However what I am doing is creating a content type builder, which basically allows to build database-driven forms with configurable fields. The idea is that once you have a content type form and you save data to it, a database object model would be generated dynamically, which would be in charge of installing, creating and maintaining the data submitted in those forms.

1 Like

Anyway, do you make your own CMS library or use an available package - and if so, which one?

Well, really it’s a CMS framework when you count all the front-end code and how opinionated it is. It uses libraries on a modular basis though (Vue.js, Vue Router, Intervention image library to name a few).

Frameworks are opinionated and whether that is good or not is subject to whether it tallies with your opinion.

It goes back to my earlier point:

I like this approach because my bets are hedged. If SwiftMailer is discontinued or there is a bug that no one wants to fix I can simply swap it out for PHPMailer. Since my framework uses wrappers for any libraries it wouldn’t be a huge job. If I had used an entire framework I’m committed to the whole thing.

There’s a lot of vitriol against custom CMSs:

Even though I am one of those single PHP developers with my own framework I understand this viewpoint as I have seen some terrible ones. Also, CMSs are inherently complex and therefore — even if they are good — hard to pass on if they’re not documented properly, which a custom one not made for mass consumption is likely to be.

That said, the years of work I have put into it let me do loads out-of-the-box while still often using < 2MB RAM and executing in under 20ms all while having more comprehensive form building and validation, SEO features and file management features (to name a few) than most other CMSs I’ve used. It’s nothing magic or especially difficult, it’s just that it’s all there because it’s my idea of a CMS and not someone else’s.

Within reason anything the client wants, I know I can add it and not have to worry about limitations of a CMS or having to sacrifice performance so while there is criticism towards this approach it pays off for me.

3 Likes

I use CodeIgniter. I’ve used WordPress but haven’t delved too deeply into it. I’ve used Wolf CMS a lot more, and I love it! Wolf is quite different from other CMS products. It doesn’t impose any structure, and it lets you do a lot of PHP coding. Yet it also provides a nice MVC framework with views and plug-ins should you choose to use it. I find the Wolf code a lot easier to understand than WordPress’s too. But I also use just plain PHP for a lot of one-offs or specific utilities.

That said, there’s no reason to code a large or significant project in core PHP. There are so many frameworks to choose from, and whatever their shortcomings may be, they produce more robust results more quickly than the average coder can produce without them. Now, somebody might develop their own framework because they don’t like anything that’s out there, and that’s fine too. But a real project from scratch? LOL No.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.