Building a WordPress Framework

I have worked with WordPress as my main CMS for over 4 years now. I love it. It makes things really easy for me.

I know there are several WordPress plugins and frameworks available. None however has really caught my attention to the point of developing under their flag -PODS kind of did for a while-. So after much consideration I decided to build my own.

There are 4 reasons why I decided to build this WordPress framework

  1. I like extending libraries instead of embedding plugins or frameworks
  2. I wanted to make it easier for you to use template engines as mustache an twig
  3. I have grown found of the way Symfony and Laravel let me work
  4. As a developer I always felt the need to give back to the community. I want to help as much people as possible achieve their goals

WPExpress Principles

Every project has to have a purpose. WPExpress purpose is to act as a modern abstraction layer for repetitive tasks, providing tools to help you separate concerns without reinventing the wheel.

  1. A WordPress Framework upholding WordPress Rules
  2. Component Based
  3. Object Oriented
  4. Composer Ready
  5. Uphold PHPFig and Semantic Versioning
  6. Open Source

1. WordPress Rules

WPExpress/Query is an abstraction layer for WP_Query and other Database functions. All database access is performed by a WordPress function.

Filters and Internationalization. WPExpress depends on WordPress when it comes to internationalization, and filters.

2. Component Based

When I started working with Symfony back in 2009. I loved it. However coming to understand the thinking process behind Symfony 2 was a little more complex.

When you start up writing an app or a website with Laravel, Yii or any other PHP framework, the road is layed down for you. I can even listen the developers behind those project whispering: “Just focus on writing meaningful code now”.

Symfony is different. You can use is a set of components or as a Framework.

Understanding this principle has influenced me to separate concerns on the WPExpress Framework.

As developers, we are sometimes tasked with simple problems which solution does not require a whole framework but instead a little part of it.

You can use WPExpress/Query and WPExpress/UI independently from WPExpress. As I move further down the path some other components may arise.

3. Object Oriented

Because globals are not the way of the future.

I use composer PSR-4 autoload functionality in the framework. I urge you to do the same.

Composer Files Autoload. If you need wrappers to invoke some functionality, it would be better of served by separate files loaded this way.

4. Composer Ready

All versions of the framework and its components are instantly loaded to Packagist.org. You can install by requiring page-carbajal/wpexpress through composer.

5. Uphold PHPFig and Semantic Versioning

Standards are important. So I like to follow them.

If you are not familiar with the terms visit the websites

6. Open Source

Because Open Source software moves the world.

If what you have read so far is interesting, I invite you to take a dive at the code. We are hosted with GitHub here: https://github.com/Page-Carbajal/WPExpress

I am working on the documentation, the wiki and some extra functionality needed. I promise to keep moving the needle forward.

If you like this little framework of mine and would like to make it yours, fork it. I am open to Pull Requests. I still have to sort out the proper way to manage contributions, but we can do that together.

How can you use WPExpress?

The sky is the limit actually.

I have found that using WPExpress cuts my coding by 20 to 30%. I use it in plugins, themes, and extensions –Which at the time are for private clients only :(. So I can’t really show them. –.

You can create Settings Pages, Custom Post Types with inherited methods, also you can use it to implement mustache and twig in your projects.

Where is WPExpress headed?

APIs and Calypso.

Although the latter is not quite clear, I still have to understand how the whole thing is gonna work. How are plugins going to extend the new ReactJS based interface. We are not going to rely on wp_enqueue_scripts any more, not for that par at least. So, there’s more to come here.

However it seems clear to me we are headed that way. 😀

If you liked this article, please share it with others. I would love to hear what you think about it.

WordPress Frameworks

If WPExpress is not what you are looking for and what you need is a more robust, solid and user friendly tool. I suggest you one of the following great projects.

Also Tesla, Genesis and Thesis. There are also several plugins available for Drag and Drop design such as Visual Composer, and MotoPress.

WP Front End Editor is also worth checking out, I love that they’re open source.