1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

CodeIgniter or Laravel or YII?

Discussion in 'PHP' started by Frank Zwan, Jan 26, 2016.

  1. #1
    My current app is in CI, but I've heard Laravel is better for some reason. What should I do??
     
    Frank Zwan, Jan 26, 2016 IP
  2. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #2
    My advice? Learn to use PHP properly and drop those rubbish frameworks that try to shoe-horn programming models that have no business in a top-down non-event driven language into your code. They offer zero real world advantages, some of them they require server level installations and changes not all hosts are even going to allow you, and result in fat bloated overhead that as of PHP 5.x really just replicates existing functionality.

    Much like HTML/CSS/JS frameworks they are at BEST a crutch for the inept, and at worst nube-predating placebos.
     
    deathshadow, Jan 27, 2016 IP
    Vooler and HolyRoller like this.
  3. NetStar

    NetStar Notable Member

    Messages:
    2,471
    Likes Received:
    541
    Best Answers:
    21
    Trophy Points:
    245
    #3
    If you are using a framework and looking to change it up take a look at Laravel. It's very intelligently written.
     
    NetStar, Jan 27, 2016 IP
  4. Varss

    Varss Peon

    Messages:
    3
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    3
    #4
    Laravel is the most popular PHP framework. It's a good choice.
     
    Varss, Feb 8, 2016 IP
    NetStar likes this.
  5. BrandStar5

    BrandStar5 Greenhorn

    Messages:
    2
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    23
    Digital Goods:
    1
    #5
    I have to agree with deathshadow

    Raw PHP scripts that are put together well is always the BEST option as any php developer can and will understand the code. As CI/Laravel and other frameworks are still php but written in a different format.
     
    BrandStar5, Feb 15, 2016 IP
    Nick_Mayhem likes this.
  6. HolyRoller

    HolyRoller Well-Known Member

    Messages:
    552
    Likes Received:
    27
    Best Answers:
    1
    Trophy Points:
    150
    #6
    They use Laravel where I currently work and it's decent enough, unless you try to use Legacy code in it which we did and it proved a disaster especially from a security point of view. Personally I would have preferred if the system had just been written correctly in the first place using well structured OO PHP, most of what you get with any framework is overkill for the average user/site.
     
    HolyRoller, Feb 16, 2016 IP
  7. NetStar

    NetStar Notable Member

    Messages:
    2,471
    Likes Received:
    541
    Best Answers:
    21
    Trophy Points:
    245
    #7
    Every website uses some sort of framework whether it's an out of the box framework like Laravel, Zend, Cake, or CI OR a collection of libraries you have accumulated or written over the years. Since *most* projects involve the developer designing the same "framework" over and over and over using (hopefully) proven patterns the point of the out of the box framework is to provide you with the solid foundation and structure that doesn't need to be reworked/tested/developed. Thus allowing you to focus on creating the project and not reinventing the wheel over and over again with the internals. That's all.. sometimes it speeds up development... sometimes it slows it down. But it provides a practical structure that ANYONE can take over and start contributing to. There are advantages and disadvantages... however at least you are eliminating the time spent for "Joey" to do things his way while "Howard" wants to do things another way forcing Peter, Bobby, and Greg to spend countless hours trying to figure out what the f^ck is going on... This will always be a never ending battle here... some are pro-framework... some are anti-framework.. Personally, I don't want to pay a developer to spend an outrageous amount of time to produce something that already exists BEFORE working on my project. Some of these "old school" programmers here would recommend everything to be built inhouse turning your 3 week turnaround project into a 3 year never ending project.
     
    NetStar, Feb 16, 2016 IP
    ThePHPMaster likes this.
  8. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #8
    @NetStar and I are polar opposites on this, and I think a lot of this is that we look at problem solving in radically different ways... This statement:

    Says it all. I don't see ANY resemblance between massive bloated framework asshattery that tries to change how the host language works, and a few simple recycled functions in a helper library...

    Possibly because the most code I'd re-use between sites for PHP is maybe 20k in 4 files. A common mail handler/validation (4k), a optionally included depending on header info gzip compression (1k) that uses register_shutdown_function so you don't even have to THINK about it if you call that first, a common library (9k) including a dozen small handy helpers (like scope breaking includes and some string processing), some session handling (again for hands off start) and hash creation, and a request parser for one index only... and my extensions to PDO (6k) that just disables manual query strings replacing them with named queries (Something I need to write an article about on my site), and adds locking to PDOStatement so that you can pass a returned statement to the skin locked so any code elevation can't try to reuse the statement for a new ::execute.

    Which would probably be more like 16k without comments. HARDLY a framework.

    To me and from what I've seen of every framework they try to change how PHP actually works, shoving programming models (like MVC) into a language that was NEVER designed for them... or shoving objects at everything without leveraging any of the actual reasons to use objects (like limiting scope) as if there's something inherently evil about making a function.

    Worse though is the simple fact that I've rarely if ever seen anything meaningful/complete done with them that wouldn't be less code without the framework, NOT COUNTING the size of the framework itself against the result. They often look really good in corner case snippets, but you get into developing a real system with it you end up with more code, cryptic code, inefficient code, and ridiculosuly convoluted solutions to the simplest of problems... MOST of that code amounting to trying to force the framework into doing what you want that it itself wasn't designed for either.

    Which is how I've seen projects end up with megabytes of PHP doing 100k or less' job, NOT counting the framework.

    Whilst certainly some of that can be blamed on rubbish markup and broken front end methodologies, I've worked on so many projects where I walk in, throw 90% of the code in the trash and end up with a cleaner easier to maintain faster running result that anyone who has ANY business working with PHP should be able to comprehend.

    Something I cannot say about any of the needlessly overthought solutions people seem to come up with using frameworks.

    It's much akin to the mouth-breathing dumbass idiocy of "template engines" -- PHP already IS a template engine, whiskey tango foxtrot do you need something like "Smarty" for other than making it HARDER to do things with? Every time I come across a "template system" in an off the shelf CMS or forums I get the overwhelming urge to shove my size 9 so far up someones backside Lemmiwinks says "hi" on the way and then they get to floss with my laces. If creating a php function and handing a few simple echo statements (or php shorttags if you're a real halfwit) is "too hard" for anyone out there, they probably have ZERO HUFFING BUSINESS WORKING ON THE FRONT-END!!!

    It all just comes across to me as crutches for the inept or lame excuses for the ignorant; people make wild claims about how frameworks save them time, make it easier to work with others, makes it easier, makes it clearer, makes it more reliable or secure...

    ... and all I can think is HOW!?!?! How is more work, more to learn, more code, and making it more cryptic "Easier" or "better"? I just don't see it.

    I'd actually kind of LIKE to see it -- but nobody has ever shown me a damned thing in any of them that wouldn't make me suck on the business end of a gas propelled lead pellet dispenser before even THINKING about using it on any project! It really makes me wonder what the blazes is in the kool-aid to lead to such outright delusional beliefs.

    But no, every time I press for such things I'm either shown rubbish that proves my point, or the person so confronted goes "I have my proof I don't need to show it to you" shoving their fingers in their ears to go "lalalala" like a second rate Vancome lady. Well Shya, you know what? Uh-uh!

    Again though, I compare it to the dumbass ignorant nonsense known as religion; I shine the light and all I see is the vast expanse of things we don't know or cannot explain yet; mated to superstitious fairy tales just because it's too hard for Joe Sixpack and Susie Sunshine to accept "we don't know" as an answer.
     
    deathshadow, Feb 17, 2016 IP
    Vooler likes this.
  9. NetStar

    NetStar Notable Member

    Messages:
    2,471
    Likes Received:
    541
    Best Answers:
    21
    Trophy Points:
    245
    #9
    Any one can go through my postings and see that years ago deathshadow and myself spoke against frameworks. I shifted my opinion after using them and seeing the company I work for switched from a home brew solution to a well structured one. I'm not pro-framework on all projects but it absolutely helps with scalability, maintenance, and programming in collaborations with teams. deathshadow hasn't used any or even knows anything about these frameworks other than assuming they are bloated. He also is a prime example of your typical old school programmer who has too much pride to use code written by someone else therefor he would refuse to work on a project unless every line of code was written by him. That's a poor programmer. That's someone who will cost you time and money on the development of frivolous things that already exist.
     
    NetStar, Feb 20, 2016 IP
  10. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #10
    The results of what people shit out with them is all the proof I need. Show me SOMETHING, ANYTHING!!!!!!!! for **** sake that even comes CLOSE to supporting your claims!

    I get five minutes into one of these things and I'm already going "what the SHIT?!?" -- sometimes I don't even get past the installation before it's setting off my bullshit alarm! ... and when I do press on it just gets worse, and worse, and worse. Again, how is MORE code, more complex code, more cryptic code, ALL of which relies on even more code... EASIER?!? What the hell type of kool aid they got you sipping?!?

    But no, you'll just continue on the bent you have every time this has come up the past year and go "I have my proof I don't need to prove anything" like a second rate food babe or anti-vaxxer.

    The true telltale of a bad programmer, one who can't back up their claims with something made properly built with the sleazy shortcuts they seem to have been deluded into thinking have value.
     
    deathshadow, Feb 20, 2016 IP
    Vooler likes this.
  11. NetStar

    NetStar Notable Member

    Messages:
    2,471
    Likes Received:
    541
    Best Answers:
    21
    Trophy Points:
    245
    #11
    My claims? I think you read fragments of my post... Anyway... You stated "The results of what people shit out with them is all the proof I need". You would have no idea what web site uses what backend framework by looking at the frontend. As for looking at random code that uses the framework you would also have no idea how the framework is actually written unless you downloaded and used the framework and dissected the code. You are a great example of a HORRIBLE programmer who can't get passed their geek ego and use a library that was written by a group of people most likely WAY smarter than yourself.

    A horrible programmer is someone who takes a 3 week project and turns it in to a 3 year labor intensive development to avoid using code written by someone else. You are inferior of modern methods in web design and programming. Some may look at you as being smart...I look at you as being absolutely stubborn and lacking practicality.
     
    NetStar, Feb 21, 2016 IP
  12. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #12
    Still, his demand for proof should be easy to provide, shouldn't it? Just post a link to a site built with a framework (should be easy enough), and even better, post some back-end code to provide some context for the functionality of the site itself.
    While I do see @deathshadow as a "fundamentalist", and sometimes way too harsh, I do see his points in dissing most frameworks - some of the built-in functionality is either way too convoluted, or way too broad, and when you need to do something that is NOT covered by the framework, there is often the same problems creating proprietary functions and/or classes to achieve what is needed.

    And, as @deathshadow, and I myself have stated, building another abstraction layer on top of an existing layer is rarely a good idea. Frameworks have an inherit fault in that they invent new ways of doing existing functionality - creating another layer of abstraction that needs to be understood and used as intended.
     
    PoPSiCLe, Feb 21, 2016 IP
  13. NetStar

    NetStar Notable Member

    Messages:
    2,471
    Likes Received:
    541
    Best Answers:
    21
    Trophy Points:
    245
    #13
    Did you not read my post either or did you just read deathshadows?

    I wrote:

    "I shifted my opinion after using them and seeing the company I work for switched from a home brew solution to a well structured one. I'm not pro-framework on all projects but it absolutely helps with scalability, maintenance, and programming in collaborations with teams."

    What "proof" would need to be posted to support my personal findings? Nothing. A claim would be "it's bloat"...
     
    NetStar, Feb 21, 2016 IP
  14. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #14
    I read your post. The point is that it is YOUR view, and that makes it just as irrelevant as @deathshadows - hence why I wanted someone to (you, for instance) post a website that is standards compliant, well built and utilizing framework(s) as its main building blocks.
    That you have come to like frameworks based on your own experience is a valid point, by all means, but since we have no idea how bad your original code-mess was, compared to a framework, it doesn't really tell us anything - hence it's just as irrelevant as any other programmer saying this and that.
     
    PoPSiCLe, Feb 21, 2016 IP
  15. NetStar

    NetStar Notable Member

    Messages:
    2,471
    Likes Received:
    541
    Best Answers:
    21
    Trophy Points:
    245
    #15
    How asinine... You would have no idea what a web site is using in the backend by looking at the front end.. and if you did you surely wouldn't know if the code, framework or not, is up to "standards compliance". And if I was to post a web site as requested it would prove no point since you cannot review the code or perform any sort of test of compliance. Did you not think of that?

    Or how good my original code is...

    By the way... you would have no idea about my practices. In fact, all of my current web sites don't use a framework.

    Are they programmed bad? No.

    Did I spend way too much time focusing on the foundation of my web site when I could have used a framework? Yes.

    Did I rehash the same code over and over? Yes.

    Did I reinvent the wheel with every web site I created? Yes.

    If I could do it all over again would I use a framework? Yes.

    Would I use or recommend a framework on every project? No.

    Am I an advocate of using the right tool for the right job and spending less time working on redevelopment? Yes.
     
    NetStar, Feb 21, 2016 IP
  16. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #16
    Well... to some extent that is true, hence why I also asked for some of the backend (anonymized, if need be) that runs said sites. However, it's often fairly simple to find some sort of framework-bits and pieces running builtwith.com or something along those lines, even just using plugins for Firefox, so completely blank, one wouldn't be.

    I wouldn't know, I haven't seen any :)
    Why would this take so long? I mean, as long as you have some inkling as to what the website is gonna do, look like, and what content you want, building a website shouldn't take that long, especially if you have reusable code.
    Known as copy and paste, change a few variables and presto, you have what you need.
    Or, you reused code you had from before, that did the job you needed to do
    Well, maybe - but then again, why would you? Why would using a framework speed up the process? This is where I fail to see the benefit. Depending on the amount of developers involved, their knowledge and so on, maybe using a framework will work wonders - but if it's a single-man operation, or if the coders you're using doesn't know said framework, and have to learn it first, then using said framework will often be just as time-consuming as not.
    Well, at least we agree on something :)
     
    PoPSiCLe, Feb 21, 2016 IP
  17. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #17
    I could almost agree with that, if, and ONLY IF someone could show me some form of framework who's codebase wasn't absolute mouth breathing dumbass bullshit ridiculously ignorant of how HTML, CSS, JavaScript or PHP are supposed to work!

    But again, nobody has shown me anything built with a framework, or a framework itself that didn't make me question the intelligence not only of the people using it, but also that of the people who made it!

    See your current evasion of the request continuing the evasion you've been maintaining for over a year on this now! ANYONE, SOMEBODY show me something GOOD made with this stuff so I can at least TRY to understand the viewpoint of them saving time, effort or producing a product one could be proud of having your name associated with!

    I've never seen it!!! PROVE ME WRONG!

    But no, it's just the "wah, wah, I don't like that you're badmouthing frameworks so I'll call you a lousy programmer and still provide no proof!"

    Lends a real air of legitimacy to supporting the use of frameworks; and ENTIRELY typical of what I deal with every time the subject comes up.

    You'd think, but they never do; it's just the same crybaby response with zero actual logical or supporting arguments to back up the claims EVERY blasted time with EVERY framework supporter.

    To the point again you'd almost think you were dealing with a creationist, foodie, anti-vaxxer or any of the other cult-like weirdness out there.
     
    deathshadow, Feb 23, 2016 IP
    Vooler likes this.
  18. Eager2Seo

    Eager2Seo Member

    Messages:
    72
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    48
    #18
    It is not an easy answer, there are pros and cons of both. DeathShadow made some awesome points though.
    A framework comes with 3 parts -
    Router(Controller) - to route URLs (instead of saying whatever.php?action=update&recno=20 you write whatever.php/update/20)

    Entity Mapper (Model) - handles your databases and queries

    Presentation (View) - Responsible for displaying data

    Problem with PHP is there is a very low barrier to entry, and you have 10 year old script kiddies (who may be very smart) start writing code with no organization and you have problems with security, code maintenance, bugs, etc. Same can be said for adults too. The framework helps create some type of standard (which has many cons) but it creates some semblance of order. The framework methods(for example) will guarantee against SQL injection if you are not knowledgeable enough to use something like PDO.

    In my opinion you need at least some type of controller. You do not want your URLs to look like 1998. Personally Codeigniter (I've never used it) looks like a very lightweight choice. You can use the CI source code to create your own or even configure your htaccess or nginx to do rewrites.

    I'll agree with deathshadow that ANY view engines are shit. You are only going to slow down PHP and IMHO they don't really make things that much more readable. You may save a few keystrokes typing but there is plenty of extra overhead to render that. PHP is a templating language. It is almost like creating a view engine over another view engine!

    As for the model - Creating a class of operations and queries for each object in your DB is enough. Then call the view to render it. If you do anything beyond simple CRUD you are relying on the framework to create queries, and I've seen in practice they things can become HORRIBLY slow.

    Now, as a new programmer it may be a good idea to use a framework or two to create a site, just to see how things fit together. But for a site that will receive heavy traffic coding from scratch is a better idea.

    In the .net world there ASP(which is similar to php) and also MVC which comes built into the IDE and System and creates a project similar to Laravel, Zend, etc. The Controller and View are pretty much built into the .NET system, so in that case you have to use it. It also comes with an Entity mapper Framework (model). For a simple app corporate app that accepts customers, invoices etc that type of scaffolding can get you up and running very quickly. However, when you start to create more complicated queries - you start to rely on the framework to generate queries, you may end up bogging down the server with those robot generated queries. The framework may decide to issue a separate query 1000X instead of a join. Then the dev they hired that never learned SQL sits dumbfounded at his PC. Many times you just have to write the SQL(model) on your own to get things working efficiently.
     
    Eager2Seo, Mar 1, 2016 IP
    Vooler likes this.