
Learn to build a simple web API with PHP 8 and explore its similarities to TypeScript, including new types. Set up a PhpStorm project for an API menu.
Install composer and set up a php 8 restful api by adding the firebase php jwt library with composer require firebase php jwt, using terminal commands and composer init.
Implement a user class with constructor property promotion in PHP 8.1, defining private and public readonly properties, set the minimum PHP 8.1 version in composer.json, and use config platform.
Install and use an API client like Insomnia or Postman to send requests, set payloads and headers, including JWT authorization. Create requests and collections to test your local REST API.
Explore how restful apis use http methods such as get, post, put, delete, and patch to perform crud operations with noun-based endpoints, aided by insomnia and postman.
Learn to set up RedBeanPHP ORM with MySQL on a development machine: install RedBeanPHP, configure dotenv, create config and a database connection, and prepare for robust API error handling.
Install and configure the Whoops package to handle exceptions and convert them into json format using the json response handler, enabling consistent json formatted error responses in production.
Set up an Apache and PHP 8 local server, enable the Apache rewrite module for friendly URLs, and configure the document root to serve PHP pages (verified with phpinfo).
Explore how RedBeanPHP ORM drives a clean, three-tier architecture for a PHP 8 REST API, auto-creating the users table and guiding entity and service design.
Implement environment-aware safeguards with a PHP enum to freeze RedBeanPHP in production, use tryFrom for safe env values, and apply null-safe calls.
Retrieve all users from the database with RedBeanPHP by returning a modified user list via array_map, removing IDs with a lambda, and presenting a clean array for API output.
Ensure a user has a unique email, check for duplicates, and securely save the password by hashing with PHP's password_hash, using bound parameters and email exists error handling.
Store the user JWT token and last session time in the database, refactor the secret key naming, and implement a set token function to update the login token.
Apply restful best practices in PHP 8 by using put for updates and returning the created user UUID. Use 404 not found for missing users and 400 for invalid input.
Continue building confidence in your PHP API by adding item entity unit tests, refactoring to expected sequential id, and asserting item properties (id, uuid, name, price, available) with PHPUnit.
In this video, you will learn how to create a CD automated pipeline with GitHub Actions to trigger your PHP unit tests on every commit pushed.
Learn how to include all project files automatically with composer autoload, configure composer.json, manage namespaces, and load environment variables for a PHP 8 restful API.
Are you eager to master the art of building professional and efficient REST APIs using the latest features of PHP 8? Look no further! This comprehensive Udemy course will equip you with all the necessary skills and knowledge to create robust n-tier RESTful APIs using all the latest PHP 8 features!
Whether you are a seasoned PHP developer or a beginner looking to dive into API development, this course is designed to cater to your needs. Through a hands-on approach, you'll learn step-by-step how to design, build, and secure a fully functional REST API from scratch.
Starting with the fundamentals, you'll gain a solid understanding of the REST architectural style and its principles. You'll explore the HTTP protocol and learn how to leverage its methods and status codes to create API endpoints that adhere to industry standards.
As you progress, you'll delve into the world of PHP 8, discovering its latest features and enhancements that make API development faster and more efficient. You'll learn how to set up your development environment, configure PHP for optimal performance, and harness the power of the PHP 8 syntax (such as the `match` expression, the PHP 8.1 `enums`, and so much more!).
Throughout the course, you'll work on real-world projects, allowing you to apply your knowledge to practical scenarios. You'll learn how to handle authentication and authorization, implement CRUD operations, handle error responses, and optimize your API for scalability and performance.
Moreover, you'll explore best practices and design patterns for building clean, maintainable, and testable code. You'll become familiar with popular PHP frameworks and libraries that simplify the API development process, such as Laravel, Lumen, and Slim.
In addition to these frameworks, you'll also utilize essential Composer packages like RedBean and DotEnv PHP.
RedBean provides an easy-to-use ORM (Object-Relational Mapping) solution for database management, while DotEnv PHP allows you to manage environment variables effortlessly, enhancing the security and portability of your API.
By the end of this course, you'll have a solid foundation in creating RESTful APIs using PHP 8 and be ready to tackle complex API projects with confidence. Whether you're building APIs for mobile applications, web services, or IoT devices, this course will show you the full potential of PHP 8 for API development.
Start today and become an outstanding seasoned REST API developer with PHP 8!