21. Final
Congratulations on completing this PHP course. You have taken your first steps in a language that powers a large part of the modern web. Now you can create and manage dynamic pages with PHP and even make a living from it in the future.
What you have learned
Throughout this course you have worked with fundamental PHP concepts that will serve as a foundation for any project:
Language fundamentals: - Variables, data types and operators. - Control structures (if, switch, loops). - Functions and variable scope. - Arrays and data manipulation.
Modern PHP 8.x features: - Constructor Property Promotion (PHP 8.0): Compact syntax to define properties in the constructor. - Readonly properties (PHP 8.1): Immutability of properties after initialization. - Enumerations (PHP 8.1): Types with predefined values for safer code. - Named Arguments: Greater clarity when calling functions. - Match Expression: A more powerful and safer alternative to switch.
Web programming: - Handling forms and validating data. - Sessions and user authentication. - Cookies with modern security options. - Uploading and processing files. - Basic web security (XSS, CSRF, SQL Injection).
Databases: - Connecting to MySQL using PDO. - Prepared statements to prevent SQL Injection. - Basic CRUD (Create, Read, Update, Delete).
Object-Oriented Programming: - Classes, objects and constructors. - Visibility (public, private, protected). - Inheritance and code reuse.
Essential tools of the PHP ecosystem
To be a professional PHP developer, you should get familiar with these tools:
Composer: PHP's dependency manager. It lets you install and manage third-party libraries in your projects.
# Install a library
composer require monolog/monolog
# Update dependencies
composer update
# Generate autoload
composer dump-autoload
PHPUnit: Testing framework to write automated tests for your code.
use PHPUnit\Framework\TestCase;
class CalculadoraTest extends TestCase
{
public function testSuma()
{
$calculadora = new Calculadora();
$this->assertEquals(4, $calculadora->sumar(2, 2));
}
}
PHP-CS-Fixer / PHP_CodeSniffer: Tools to keep your code clean and consistent by following standards (PSR-12).
Xdebug: A debugger that lets you analyze your code step by step and detect problems.
Additional PHP 8.x features
PHP 8.0, 8.1, 8.2 and 8.3 brought many improvements. Some that we have not covered but you should know about:
PHP 8.0:
- Union Types: function ejemplo(int|float $numero): string|null
- Nullsafe Operator: $usuario?->direccion?->ciudad (avoids errors if something is null)
- JIT Compiler: A significant performance improvement in specific applications.
PHP 8.1:
- Fibers: Low-level concurrency for asynchronous code.
- Array unpacking with keys: ['a' => 1, ...$array]
- new in initializers: Using new in default parameter values.
PHP 8.2:
- Readonly classes: Fully immutable classes.
- Disjunctive Normal Form (DNF) Types: More complex types such as (A&B)|C.
PHP 8.3: - Typed class constants: Class constants with types. - Override attribute: Explicitly indicating that a method overrides the parent.
Recommended next steps
I would love to tell you that you already know everything, but you don't. There are still many concepts you can keep working on to become a better developer:
1. Go deeper into SQL: - Query optimization. - Indexes and performance. - Transactions and ACID. - Complex joins and subqueries.
2. Learn Git: - Version control is essential for any developer. - Collaboration in teams. - Git Flow and branching strategies.
3. Modern PHP frameworks: - Laravel: The most popular framework, ideal for complete web applications. - Symfony: A robust and modular framework, used in enterprise projects. - Slim: A microframework for APIs and small applications.
4. Testing and quality: - TDD (Test-Driven Development). - Continuous integration with GitHub Actions or GitLab CI. - Static analysis with PHPStan or Psalm.
5. Architecture and patterns: - MVC (Model-View-Controller). - Dependency injection. - Repository Pattern. - SOLID principles.
6. Modern APIs: - Advanced REST API. - GraphQL. - Authentication with JWT (JSON Web Tokens). - OAuth 2.0.
7. E-commerce: - WooCommerce (WordPress). - Magento. - Sylius (Symfony).
Recommended learning resources
Official documentation: - php.net - Official PHP documentation, always up to date. - PHP: The Right Way - Best practices guide.
Frameworks: - Laravel - Excellent documentation and tutorials. - Symfony - Complete documentation.
Community: - PHP Reddit - News and discussions. - Laracasts - Quality video tutorials (mainly Laravel). - SymfonyCasts - Symfony and PHP tutorials in general.
Recommended books: - "Modern PHP" by Josh Lockhart. - "PHP Objects, Patterns, and Practice" by Mika Schwartz. - "Clean Code" by Robert C. Martin (not specific to PHP but essential).
Final reflection
PHP has evolved tremendously in recent years. PHP 8.x is a modern, fast language with features that put it on the level of other contemporary languages. Do not be swayed by old opinions about PHP 5, the language has matured significantly.
The most important thing now is to practice. Build real projects, make mistakes, learn from them and keep improving. Programming is a continuous journey of learning.
Wishing you every success in your career as a PHP developer!
This work is under a Attribution-NonCommercial-NoDerivatives 4.0 International license.
Desafíos de programación atemporales y multiparadigmáticos
Te encuentras ante un librillo de actividades, divididas en 2 niveles de dificultad. Te enfrentarás a los casos más comunes que te puedes encontrar en pruebas técnicas o aprender conceptos elementales de programación.
Buy the bookWill you buy me a coffee?
This is how I keep writing without ads or paywalls.
Sure, it's on me!
Comments
There are no comments yet.