r/PHPhelp • u/[deleted] • Aug 18 '20
Good PHP starting points for a Team?
I have a team that is to switch from Python/Django to a PHP based CMS. Since there is zero PHP knowledge in the team at the moment I wonder about how to built up some knowledge.
Can you give me some hints? Are there some learning resources that are generally seen as good starting points? Are there blogs/forums/communities/movements one should be aware about?
1
u/Jipsuli Aug 18 '20
What CMS? Generally that particular CMS documentation is always valid place to start, there might be good tutorials in youtube also. Specially if it's some commonly used CMS with large user base like Laravel.
For PHP https://phptherightway.com/ is good site to check how to make things properly, check "resources" for more.
1
Aug 18 '20
We have not decided between NEOs and Wordpress, yet. I thought it might be clever to have a small toy project before we go for the big one. Just to make our beginners mistakes before we cement them in place forever.
3
u/dougalcampbell Aug 18 '20
I hadn’t heard of Neos before now, so I can’t really offer much advice there.
On the other hand, I was one of (very) early Core Developers for WordPress (ca. 2004), so I can offer a few thoughts on that subject.
I’m sure you’re already aware that WP is the most widely used CMS around. This is largely due to it not only being one of the earliest Open Source systems available, but also because it is both user- and developer-friendly. It had its roots in blogging, so it’s still fairly blog-centric, however, over time it has become a very capable CMS in a more general sense.
The extensibility of WordPress through Plugins and Themes is probably the biggest driver of its popularity. And most of that is driven by its concept of “actions” and “filters”, collectively known as “hooks”. The closest other thing I can think to compare that to is if you are familiar with NodeJS and Express, actions are like events, and filters are like middleware.
Filters, predictably, are used to examine and alter content or data as it passes through various parts of the WordPress flow. This could be something as simple as the title of a post or page, or a complex data structure like the ones used to generate hierarchical drop down menus, or even the SQL queries used to talk to the database.
Actions are much like events in JavaScript. The system fires off certain action hooks at various points in the system’s execution, and you can add your own functions to be called. This could be to instantiate your own classes to be used later, inject content into various points in your theme or the admin interface, or various other things.
One thing that might seem odd or clunky is the Themes system. WordPress made the decision early on to not use a separate templating library, and instead just uses raw PHP as the template language. This has had its pros and cons. On the pro side, it made it really easy for newcomers to modify and create themes with minimal PHP knowledge, and without having to learn a separate “language”. On the con side, it really muddies the idea of separation of Views from business logic (Models/Controllers). However, most well-designed themes will keep their heavy coding in separate function files, and use simple convenience functions in the actual templates to call out to them. That said, there have been add-ons that let you use a separate template language for theming (e.g., Smarty or Twig).
One last thing that WordPress has going for it is that upgrading is generally very safe. They’ve always taken great pains to not break backwards-compatibility. You’ll still want to read the Release Notes for each new version before upgrading, just in case, but problems with upgrades have been exceedingly rare. Compare that to Drupal, where major version upgrades most often require extensive planning, and code/data migration. On my personal WordPress sites, I actually run the ongoing development branch, and I automatically pull updates several times a day.
Speaking of versions, note that WP does not use the SemVer conventions. If you consider the “no breaking changes” rule, this makes sense (if you look back at the early version history, you’ll actually find skipped versions and versions with four components instead of three, before they eventually settled into the current system). When you see a version as X.Y.Z, the Z portion will always indicate a bug/security update with no new features. But the X.Y portion is always just updated incrementally, regardless of how significant (or not) the new feature set is. So keep in mind that an upgrade from 5.9 to 6.0 is no more or less meaningful than an upgrade from 5.8 to 5.9 or 6.1 to 6.2.
Lastly, keep in mind that because it’s so easy to create plugins and themes and have them added to the repositories on wordpress.org, their quality can, um, vary greatly. Over time you’ll probably pick up on various community members and groups whose code you can trust. But you’ll find that the most popular commercial plugins are very high quality. I can certainly recommend a few like Advanced Custom Fields, Gravity Forms, WooCommerce, All In One SEO Pack, and Yoast SEO, among others.
Sorry for writing a book. But if you have any WP questions, feel free to hit me up.
1
u/ondulation Aug 18 '20
That’s a really broad question, can you please elaborate a bit. Why switch to a cms/framework/language where no one in the team has experience? Will everybody switch to php or only part of the team? What budget do you have for the switch? Google “PHP for programmers” and you will find lots of resources.
1
Aug 18 '20
We haven't decided between NEOS and Wordpress yet. We hope that we will have less maintenance work when we use a of-the-shelf CMS instead of a custom built one like the current one. All of the devs will have to work with PHP. We have enough budget to get all the learning resources that seem sensible.
I was hoping for a recommendations for resources that are known to be good as I suspect that there are a lot of bad resources out there.
1
u/ondulation Aug 18 '20
I’m not a professional programmer, so first of all you should take my words with a grain of salt. I am however reasonable fluent in general and php programming (including Wordpress) to have some thoughts about it.
Wordpress is an amazing system, with that comes great complexity. For experienced programmers, the WP Codex is invaluable. For some, it might be all that’s needed to get up to speed with php and WP.
Generally I would definitely consider starting off with some “PHP programming for programmers”. I’ve not used it myself but PHP The Right Way seems to be a great resource.
Considering that your whole team are learning a new framework AND a new language, it would be in place with classroom training (or at least some way to discuss coding and concepts together). People will probably learn different subsets of PHP and take on the challenge from different angles (some like to read the manual, some like to only read code, they have different backgrounds etc).
Some parts of WP development are moving fast (I think the visual editor is one example) while other are old and steady ground. So choose tasks wisely and set aside time and money to learn successively over the course of a year. For example, theme development is easy to learn but can be surprisingly hard and complex to do properly so don’t count on doing it right the first time around.
Finally I wouldn’t count out paper books . It’s really handy to have a physical reference and in my experience books often cover advanced topics much better than websites do.
2
Aug 18 '20
There are some very wise things in your post. Perhaps you should consider becomming a professional programmer. Thanks a lot. I didn't know about the codex yet.
1
3
u/GlowingCorbett Aug 18 '20
First, you check basic php enviroment which said in other comments
After that ,I suggest start with laravel php framework. Laravel is popular and fast learnable one of PHP frameworks. Here is great site which have many educational videos;
1
u/fz-09 Aug 18 '20
I second this. Obviously it depends what sort of application you want to build but Laravel is pretty great for many things.
2
u/owenmelbz Aug 18 '20
Not quite for what you asked, but if you need a rock solid CMS that’s great for php starters, checkout Craft
1
Aug 18 '20
I started in my current position a little over a year ago. When I got here they were still using PHP 5.x and I had never touched PHP. One of my first tasks was to rebuild one of the web tools, initially they wanted me to just make a copy of it and continue doing things the way they've been doing them. I promoted the idea of switching to a framework and building it from the ground up. So I started using Symfony and I haven't looked back. There are a lot of great resources, I would advise spending some time learning PHP fundamentals, then just deep diving in to Symfony. I chose Symfony just because of it's history and modularity.
5
u/[deleted] Aug 18 '20
Here is a great site:
https://phptherightway.com
And
https://www.php-fig.org/psr/