The Best Resources to Learn PHP and MySQL
PHP still powers a huge share of the web, from WordPress sites to modern Laravel and Symfony apps, and MySQL is right there beside it. If you want to learn both, there has never been more good material available, much of it free. Here are the resources we'd recommend, in the order we'd use them.
Set up first
Learning goes faster when you can try every example yourself. Our guide to running PHP and MySQL locally gets you a working setup in under an hour.
The official documentation
- The PHP Manual: clear, complete and full of examples. The "Language Reference" section is a great read from start to finish once you know the basics.
- MySQL Documentation: the reference for every statement and function, plus a helpful tutorial chapter.
- MariaDB Knowledge Base: friendly, well-organised articles that are useful even if you use MySQL.
Guides to modern PHP
- PHP: The Right Way: a community-written overview of today's best practices, from Composer and coding standards to security.
- Laracasts: famous for Laravel, and also home to an excellent "PHP for Beginners" video series that builds a real project step by step.
- Symfony: The Fast Track: a free book that builds a complete app and teaches professional habits along the way.
Practise SQL
- SQLBolt: short interactive lessons that run in the browser. Perfect for your first week of SQL.
- DB Fiddle: try queries against MySQL, PostgreSQL or SQLite without installing anything, and share them with others.
- Our own articles on handling NULL in SQL and preventing SQL injection cover two topics every PHP developer meets early.
Tools that teach as you go
- Composer and Packagist: learn how to install packages early. Reading popular packages is a great way to see well-written PHP.
- PHPStan: a static analyser that points out bugs before you run the code. Its messages are a lesson in themselves.
- Your editor: VS Code with a PHP extension, or PhpStorm, will autocomplete functions and show documentation inline.
A simple learning path
- Week 1: variables, arrays, functions and forms, using the manual and a beginner course.
- Week 2: SQL basics with SQLBolt, then connect PHP to MySQL with PDO and prepared statements.
- Week 3: build a small project, like a guestbook or a to-do list, with create, read, update and delete.
- Week 4: add Composer, a framework tutorial and PHPStan, and read our list of common PHP mistakes.
The best resource of all is a small project you care about. Pick one, keep it simple, and let the documentation fill in the gaps as you go.
Comments
Post a Comment