DEV Community

Cover image for Building a PHP Framework: Part 1 - Why? Seriously, Why?
Matt Sparks
Matt Sparks

Posted on • Edited on

Building a PHP Framework: Part 1 - Why? Seriously, Why?

There are a tremendous amount of great PHP frameworks. Off the top of my head I can think of several: Laravel, Symfony, Yii, Slim, Cake, etc. Yet, for every Laravel there are probably five lesser-known, high quality frameworks. Go ahead and search Github for “PHP Framework.” As of this writing it lists 20,000 results. Sure, most aren’t fully fledged PHP frameworks, but that’s still a lot of code.

So with all of that being said, it begs the question: why on Earth would you want to do this?

The extremely short answer: I want to.

The less short answer: A PHP framework encompasses many of the areas I want to learn more about.

Why I’m Building a PHP Framework

Look, I’m very aware that there is no need for a new framework. I agree with that. For whatever problem you’re trying to solve you’ll no doubt be able to find a solid solution.

I’m not trying to reinvent the wheel or make a “better” code-base. I’m under no delusions of grandeur – this framework will never see a production environment. If it does, may God have mercy on your soul.

I’m building this to learn. That’s really the long and short of it.

What I Want to Learn

There are a number of areas that I would like to have more knowledge of. Chief among them are:

  • Application Architecture
  • Design Patterns

Other areas include (but aren’t limited to):

  • Routing
  • Cache
  • Database Abstraction
  • IoC
  • Code Organization
  • Testing

All of those topics fall into the “yeah, I ‘get’ it but do I really understand it” category. That’s what I hope this little experiment solves.

What This Won’t be

It is not my intent to make a production-ready framework. I have no plans of making a robust code-base. This project is a tool to help me (and hopefully others) learn. Anything after that is just gravy.

What’s Next

Before I build a framework, I should probably figure out what exactly a framework constitutes. That doesn’t sound intimidating at all.

Wait! We Need a Name

I can’t keep referring to “the framework” or “code-base.” I’m one post in and it’s already getting old. Let’s call it the Analyze PHP Framework. Seems appropriate to me.

Originally posted on DevelopmentMatt.com

Top comments (4)

Collapse
 
joshualjohnson profile image
Joshua Johnson

Haha! I can't tell you how many PHP Frameworks I've built over the years. It all started with Zoose, z20, Zoose2.0, ulfberht-application...and so on. Now I'm building my final framework. FireStudio! Over the years I've built frameworks as a way to understand design patterns. Thanks for sharing your thoughts! I can appreciate the task you are trying to pull off!

Collapse
 
bosepchuk profile image
Blaine Osepchuk

You've got an excellent reason to build a framework.

Have you made any architecture/design decisions yet? Any decisions you care to share?

Collapse
 
mattsparks profile image
Matt Sparks

Thanks, Blaine!

I've yet to fully decide. I have a general idea of how I want to try and structure things, but I need to get more of a concrete implementation in mind. I'm hoping to make that apart of my next post (which should be later this week).

Collapse
 
bosepchuk profile image
Blaine Osepchuk

Cool. I'm looking forward to reading it!