FrameWork or No Framework for Oldschool PHP Programmer

I’ve been using php for about 12 years now and because of this my coding style is a bit archaic. I have been hiring and managing other php programmers for projects within the last 4 years or so, but im ready to take more control of my projects and do the coding myself. I create a project 1 or 2 times a month and these generally contain web applications, custom seo, mod rewrite shortlinks, data, and occasionally user accounts and associated forms. I plan on developing some web apps that are mobile friendly and responsive as well.

Should I invest my time in learning a framework if i know how to do most everything I need to do already? I have code from countless projects in the past I grab when I need something, but the code is sloppy (sloppy may be an understatement). What would frameworks offer to someone like me who has been doing this for some time, but has fallen behind most new programmers in terms of ability and proper usage. It seems to me most sites can be built with just common php knowledge.

I’d like to start a dialogue and ask some of the newer and older professional php programmers what they think.

A few questions…

1.) Are frameworks written to be streamlined, or do they bog down your servers because they contain so much unused code?
2.) Are frameworks written to assist those who do not know php get their projects completed more easily?
3.) What are the benefits of most common frameworks Laravel and Phalcon (Best PHP Frameworks 2014)

Im sure ill have more questions, but thats it for now.

Thanks ahead of time to anyone willing to interact.

I don’t know too much about php frameworks specifically (I’ve only dabbled with PHP ones), but I can answer a couple of these speaking generally.

  1. Most are designed to be streamlined. They do contain a lot of code, but if the code is unused, how does it bog down anything? A lot of what you will find is they do a lot of the extra crap that SHOULD be done in every app, but is very tedious, time consuming, and all around boring. Such as XSS protection.

  2. Like I mentioned above, the biggest advantage of using a framework is having a framework to an application already there. Having all the crap that you should be doing in every application already there and done for you, so you can spend less time with that and more time getting something out the door.

They aren’t made to make it easier or harder on someone new to a language, they are made to make it easier and less time consuming on the developer regardless of experience. Some can obviously be geared more towards beginners than others, but that doesn’t always mean it’s a bad thing for an advanced developer it just means it’s easier on new ones. Sometimes you’ll find that frameworks geared heavily towards beginners will try to keep you inside a black box and make it hard as hell to go outside that box.

  1. More Popular = More Community = More Support. But as far as framework specific, idk.

I guess i was associating more code with larger files that were loaded. A simple test I guess would to be to load a hello world with and without the framework and see what the difference is in load.

Thanks for the input. Anyone else?

A framework is going to add overhead (unless you want to get in to what a bad developer can do to make things slow in/out of a framework). What it helps with is ease and speed of development. IMO, having some sane consistencies across your projects is well worth the very small footprint (in most cases) you will incur.

Awesome thank you. So a positive would be source consistency across projects, while a negative would be the fact that the framework does increase resource usages slightly.

Thank you. Anyone else care to weigh in?

1.) Are frameworks written to be streamlined, or do they bog down your servers because they contain so much unused code?

CodeIgniter was my first framework and I was impressed with the active and friendly forum. Updates were easy to install due to changing a single line of code in the index.php. The framework was streamlined with many features which I never use. One cache feature (there are about five) that I liked and is remarkably easy to implement. Every URL is checked and if available a file cached version is called otherwise normal MVC with a timed cache version stored. Sad to say CodeIgniter does not take advantage of the latest PHP features and is now for sale.

I have tried other frameworks, all with similar features and still undecided.

2.) Are frameworks written to assist those who do not know php get their projects completed more easily?

CodeIgniter has a structure which make it easy for other programmers to follow. There are thousands of routines and/or libraries available and also examples are usually slotted in and activated with a single line of code. CodeIgniter also allows the stucture to be used and/or abused to suit individual preferences.

3.) What are the benefits of most common frameworks Laravel and Phalcon (Best PHP Frameworks 2014)

They all “stand of the shoulders of giants”, easier to install and all utilise the latest PHP features and/or improvements.

As an exercise the last couple of projects (blog and photo album) were specifically written without using a framework. What I missed most was the structure and libraries. Having to rewrite basic routines and then to ensure they were all bullet-proof was no mean task. Most frameworks have all tried and tested routines.

just my two-cents

Hi,

I’d second the points made by mawburn and Kyle. Just to further the point about framework overhead and resource usage, keep in mind the often quoted maxim about developer time being more expensive than computing power. Ideally, what a good framework costs you in overhead is more than made up for in savings of your time both developing and maintaining software that you write using it.

It’s worth bearing in mind that, depending on the kind of project you’re working on, it’s not always necessary to go for a ‘full-stack’ framework. There are also ‘micro-frameworks’ such as Slim and Silex which don’t come with all the bells and whistles of a bigger framework and are ideal for building things like APIs.

As you describe yourself as not being up-to-date with modern php coding practices, I think getting to know a framework like Laravel would help you to get familiar with things like namespaces, dependency injection, events, and queues (Symfony2 is also a good framework for learning best practices, but I think it’s a less gentle introduction if you’re new to some of these concepts).

I’ve not used Phalcon, but I do know that it’s written as a PHP extension which means you often won’t be able to install it on cheaper, shared hosting.

Heck yeah. I appreciate all the input John_Betong and fretburner.

OK. So from a security standpoint Frameworks are a sure WIN. The development costs are another win.

Any other input from people in future is also welcome. Again thanks for the current input SitePoint.

Just remembered another excellent reason for using frameworks along with an example of an upgrade from MySQL to PDO:

As mentioned the upgrade took about an hour :slight_smile:

1.) Are frameworks written to be streamlined, or do they bog down your servers because they contain so much unused code

Naturally yes. Frameworks, libraries or platforms all abstract details from you as a developer so you can focus more on value added features instead of infrastructure and boiler plater code.

2.) Are frameworks written to assist those who do not know php get their projects completed more easily?

Frameworks, not so much, they typically provide a high level set of common software patterns, and usually understanding patterns, the motivation behind them, you probably need a few years of programming experience to appreciate what they do. Libraries usually hide details particular to very specific units of functionality, such as PDF generation. Instead of learning the ins and outs of PDF spec you can use a high level API to build documents instead, so in that case, I suppose libraries help. Platforms, in the web arena, such as WordPress/Joomla/Drupal/etc are meant to make specific types of web sites or apps easier to build and in some cases without any programming required, although having a background in PHP certainly helps troubleshoot issues when they arise.

3.) What are the benefits of most common frameworks Laravel and Phalcon (Best PHP Frameworks 2014)

Please avoid using the term “best” it’s very subjective. Answer the question by asking yourself about personal requirements and possibly project specific. How important is performance? If it is paramount, than Phalcon (being compiled extensions) is the winner, but if portability and resale to multiple clients is most important, than something purely PHP is a better alternative (ie: codeignitor).

Alex

Are any of your existing applications open source? If so, consider posting a link to the source code for a couple of them. It would be interesting to refactor them using the latest and greatest php functionality and frameworks.

That was reference to an article that sitepoint posted, and that was their title maybe tell them that. Best PHP Frameworks 2014

That aside thank you very much for your input.

  1. I guess some frameworks are more bloated than others, but if you don’t plan on developing a really popular web application or website, it shouldn’t be a problem. Also, good frameworks are written in a way that the overhead of needed resources is reduced to a maximum. And there are other strategies to add performance to a PHP application (APC, Redis, Varnish…)

  2. Well, I think that everybody that know what they are doing should use a framework. It will save time, it will make them organize their files in a specific manner. Also, good frameworks follow best practices in terms of MVC.

  3. I guess that they are simple to use and “lean”, probably why they are popular. I never used any of them (yet) so I can’t really comment :wink: