Introduction
Forme is an MVC application framework designed to bridge the gap between WordPress and modern development practices. With Forme, you can craft themes and plugins for WordPress using a modern, expressive PHP syntax.
Why Forme?
We've got a lot of love for WordPress - it's got comprehensive docs, it powers half the internet, and many web developers earn their PHP chops working with it. Clients love it - its ubiquity and familiarity makes it the defacto CMS of choice for a vast amount of projects, from mom and pop outfits right up to enterprise level.
However, a lot of WordPress code is stuck in a bygone era of clunky workflows, bad procedural patterns, weird antiquated syntax, and a tendency towards unmaintainable and untestable spaghetti awfulness. And don't even get us started on the loop, which is just... wrong. 🤢
If you've done any amount of work in modern PHP frameworks such as Laravel or Symfony, you will want to bring similar patterns and best practises to bear on new or legacy WordPress projects, but it isn't really designed to support those out of the box.
Forme aims to solve these pain points.
There are a bunch of really cool Open Source projects already operating in this space, including LumberJack, Timber, Themosis and the Roots ecosystem. We've taken inspiration and ideas from all of these, but built Forme to follow our own specific and opinionated workflow.
Features
- MVC Pattern: Keep your code organized and maintainable with a typical Model-View-Controller (MVC) pattern
- Eloquent ORM and Phinx DB Migrations: Interact with the database using Laravel's Eloquent ORM and manage database migrations with Phinx.
- League Plates 4 views: View templating engine. (Plates 3, Blade, or Twig are also supported.)
- DI Container: Dependency Injection (DI) container to manage dependencies and promote modular, testable code.
- Flexible routing system: Define custom routes and handle HTTP requests using Forme's flexible routing system.
- YAML config for WordPress hooks: Configure WordPress hooks using YAML files, providing a more structured and readable approach.
- Registry pattern: Use the registry pattern to group together WordPress hook calls.
- Theme & Plugin boilerplates: Get started quickly with Forme's theme and plugin boilerplates.
- PSR-4 and Composer: Follow PSR-4 autoloading standards and manage dependencies with Composer.
- Dotenv: Use environment variables with Dotenv for convenient configuration management.
- PSR-7 Requests and Responses: Work with PSR-7 compliant request and response objects for standardising HTTP communication.
- PSR-15 Middleware: Implement middleware components to handle cross-cutting concerns and modify requests and responses.
- Debugging Tools: Forme provides debugging tools to assist with troubleshooting and development.
- Code Generation CLI: Use Forme's command-line interface (CLI) to scaffold code and automate repetitive tasks.
- Test Setup: Forme supports unit, integration, and end-to-end testing to ensure the quality of your application.
What Forme is not a good fit for
Since Forme relies on Composer/PSR-4 and a custom server setup, publishing plugins or themes to the WordPress store is not currently practical. Better to stick with distributing them via Packagist for the time being. We are working on a solution though, so watch this space!
Who made this?
Forme is built and maintained by Moussa Clarke, senior developer over at Sanders Web Works in Wiltshire.
We're a friendly multi-disciplinary team specialising in building bespoke digital solutions for a range of small and medium size business clients, as well as local government and third sector companies. Aside from WordPress, we're dab hands with Laravel, Vue, Symfony and much more besides, and can also handle visual design and copywriting briefs inhouse. We move fast and fix things.
If you've got a project that you think we could help you with, please get in touch!
Any future plans?
Yes! The following features are currently on our roadmap:
- Package Forme plugins and themes for the WordPress directory using PHP Scoper
- Better test coverage for the framework and codegen codebases