Even though I've always been one of those 'computer people,' I'm actually a writer. After working in tech for a while in different jobs, though, I'm now building something for myself for the very first time, and I'm building it in bare PHP without any frameworks.
Am I making a mistake here? I started out this way because the project flowed out of a very basic php course that I did, but the more I look into things, the more people advise me to use more modern development methods, most often Laravel or Symfony.
I think there's some value in first learning stuff the hard way and learning how everything works under the hood, but could I be working three times as fast and five times as easy if I'd be using frameworks rather than doing everything myself?
At this point, it's actually going to be a sunk cost thing where I just have to go on with this project the way I started, so maybe your advice will be more valuable for my next project rather than this one.
Modern PHP doesn't really require you to use frameworks, just pull together the modules you need :) Good article on that matter: https://kevinsmith.io/modern-php-without-a-framework
The first interactive application I every built and deployed to the world was a single, gigantic PHP file. I think there was an
if/elsestatement that spanned 2000+ lines. It was hell to work with, but I do think it gave me a greater appreciation for the principles underlying the right way to do things. It helped me understand why the frameworks were so intelligent. I also fell in love with Ember and the problems it solves after working on my own built-from-scratch single-page web apps.Then again, it's both wiser and more effective to be able to learn from others' mistakes without having to repeat them yourself. Life is only so long, so ideally you can spend it at the boundaries, building on what others have learned so you can make brand new mistakes of your own.
So basically, a study of software architecture and the underlying principles of what makes for maintainable software is really more relevant than raw php or laravel?
It's funny... before I started working I thought there was a baseline competency that everyone would have and that included knowledge on how to write maintainable code etc. So far from the case. In my experience like 10% ~ 20% of devs know how to do it well. The rest just do what they're told and try not to get in trouble.
So I think it gives you a big leg up in learning your craft and building things that eventually don't suck. God only knows all the horrible hot messes of shit I built during my uni days.
I hear these types of questions a lot from people just starting out in the dev field:
But the real question that we should be asking is what are the problems your tackling? Does PHP address these issues without having to reach for a framework? Then use that. If you find the need for a certain feature that only a framework can provide, only then should you go grab it. Too often I see people over engineering a solution to problems that they will never have.
I would suggest going and looking up Pieter Levels and reading about how he built a business based off of a product that was a single PHP file. There's nothing wrong with doing things the way YOU want, to address the concerns YOU have.
https://twitter.com/levelsio/status/938707166508154880
Yea that one! lol
Given how hard security is to do and PHPs poor track record at it, I would say yes. Frameworks help with this.
You started. That's the best thing that could have happened to you. Keep on working.
Of course, technically, it is often a good advice to use a framework. But learning a framework is in an investment of your most important resource: Your time. Do you want to be a developer or do you want to be someone who can create great products? Should you invest more time in optimizing your programming skills or how to be a better sales person?
I love to code. I am a passionate software developer. But if i would have known some years ago, that i want to take the path of an indie hacker i would have invested much more time in learning more about sales.
Almost certainly, yes. It's not just that there's a ton of stuff written for you, it's that with a framework there's a ton of stuff already written and gone through countless manhours of testing and bug fixes that you don't have to figure out on your own.
It's hard in the beginning but way easier (and better) in the long run. Take a breath, learn a good framework, and then make your project.
We all found ourselves in your position once.
I'm about half way through writing a blog post that would answer this question in depth, but the tldr is, "if bare PHP is something you know and can build your project in, it's definitely the thing you should be using."
In my opinion, yes.
I believe you should accelerate your development cycle as much as possible, get a prototype in front of people and optimise later.
I believe you should aim to remove as much work from your plate as possible, allowing you to compose a new solution out of other pre-existing solutions.
I personally don't use frameworks because Go (my language of choice and profession) doesn't have many available and it's not really "a thing", but I do use a lot of libraries.
I'll use a library to:
accurate (to a high decimal place) is important in finance
And so on.
Using a framework or series of libraries will accelerate your ability to push something in front of the world and validate the idea today, instead of next week.
Don't overly optimise now, you can do that later. Build a monolith right now but break it down into a series of (Serverless based) microservices tomorrow.
When I think, "Should I use a library for this or write my own implementation?" I like to remember one thing: I'd rather my car had four round wheels made by someone else versus my own implementation that looks something like potato.
Since you're not going to change course on this project, it doesn't matter. Treat it as a learning experience. As someone else commented, this is a great time to learn about the security issues you face. For example,
When you look at having to do it all again for your next project, then you're probably going to pause and say, "Hmm. Let's use a framework."
I started out a similar way, always learning the hard way first, and grew into frameworks after basically reinventing the wheel and having that "oh... duh" moment quite a few times.
In my opinion it depends on what the goal of your web app is - if you're building an MVP of a product then I'd say build it as fast as possible and just assume you'll be throwing this version away it starts to gain traction and rebuilding it in a framework later. That way you can get something built.
If your goal is to learn more about coding and systems, then I'd recommend being a little more forward looking and learning to use a framework.
Though realistically every project will be a little of both, so start quick to get something built, but keep your eyes open for how a framework could've helped solve your (probably very common problem) in a more robust and simpler way.
Also the best framework you're going to find is one with amazing documentation, so make sure to look for that in any tool you pickup.
Your first web app will be more about learning core concepts like styling, HTML structure and Javascript functionality. It is not important which frameworks you use, or if none. Besides, it is good to get familiarized with the language which frameworks are built on, before using the framework itself. I don't think you are doing anything wrong.
Good luck
Wow, great insightful answers all around, and they get to the exact issues I'm experiencing. Security, sessions, user management and the admin side of things are hard to do, and I often feel like I'm wasting time on them when I could be coding actual features.
So I'm going to do as some of you suggested and treat this as a learning experience and a building block in my programming education and just finish the first version of this project as quickly as possible in the way I've started it.
Then while my first testing users validate the aims of the product and determine what features are actually necessary, I'll spend the time to get better acquainted with one of the big frameworks so v2 of the project can hopefully be built a lot more efficiently.