3 ms·
Semi-related: what's the best place to learn the old school style of working with php, I already know laravel but it feels so far removed from normal php that I
by spacebuffer 2y ago
Semi-related: what's the best place to learn the old school style of working with php, I already know laravel but it feels so far removed from normal php that I am not confident working with it on it's own.
- hu3 2y agoI would try some "old style" php frameworks. Like CodeIgniter or Yii. If you want even simpler, then maybe try Slim framework. You'll have to add your own data access lib. If you want Grug brain PHP then there's https://github.com/bcosca/fatfree https://github.com/bcosca/fatfree You can also use composer package manager to build your framework with libs like routing, sql query builder, etc.
- wild_egg 2y ago> Fast and clean template engine Is PHP not already a template language? The whole idea of PHP frameworks always confused me. Why do I need a router when I can simply add new files at the routes I want?
- hu3 2y agoYou're right, it is. The advantage of a router is basically: please always execute this code (auth, db connection, logging, session, rate limiting, csrf protection) before running the actual code for pages that will be rendered. Or you could also just keep using normal page.php files and possibly include a boot.php at the top of the pages to achieve the same. But then you don't get pretty URLs unless you're doing some server URL rewriting. Come to think of it, routers require URL rewriting too.
- oopsallmagic 2y agoWhy not read the PHP docs and any tutorials they might have? The docs are pretty comprehensive.
- dventimi 2y agoBecause they're mostly a vast array of reference docs with just one simple tutorial that barely scratches the surface? https://www.php.net/manual/en/index.php https://www.php.net/manual/en/index.php
- oopsallmagic 2y ago[flagged]
- simonbw 2y ago0. Forget everything you know about php and programming in general really. 1. Make a simple web page in an html file 2. rename it to .php 3. then throw in some <?php ?> tags 4. Look up [include](https://www.php.net/manual/en/function.include.php https://www.php.net/manual/en/function.include.php) and not much more 5. PROFIT At least that's how I remember writing php in high school.