
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.
Discover why PHP remains strong in 2025, explore PHP 8.2 features like readonly classes and standalone types, the evolving ecosystem, and pathways to Laravel or Symfony for building APIs.
Explore how json web tokens secure a restful api, enabling stateless authentication by encoding a payload into a jwt, generating tokens from user data, and decoding them for authorization.
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.
Create your first php file, index.php, and optional routes or endpoint files to echo hello world with the opening php tag, then run the built-in server on localhost.
Learn to include root.php and routes.php using require_once and require, understand single versus double quotes, and load the composer autoloader from vendor/autoload.php to initialize routes for the first endpoint.
Create the first endpoints for your php 8 rest api by organizing code in a src folder, defining a user class with a constructor and a create user method.
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.
Upgrade your local php version to php 8.2 to align with your project, using Homebrew on Mac, Chocolatey on Windows, or apt on Ubuntu, and verify with php -v.
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.
Implement the user class and endpoints for create, retrieve, retrieve all (returns an array), update, and remove, using PHP return types like bool and int and returning updated user data.
Create and organize helpers for a PHP 8 RESTful API, including a JSON response helper and a dedicated headers class to manage content type and cross-origin access.
Add namespace and autoload with composer, update composer.json, include root files with require_once, organize headers and api under the ps7 namespace, and run composer dump autoload.
Implement your first API routes in PHP 8 by wiring a user route with a switch to handle actions like create and retrieve and manage request parameters.
Learn how to replace switch with match in PHP 8.0, combine match with enums introduced in PHP 8.1, and route actions like create, retrieve, remove, and update.
Finish implementing user routes and request handling in a PHP 8 RESTful API, using enums and match for actions, returning proper Json responses and http status codes.
Send a json payload to a user creation endpoint, distinguish payload from body, and parse the request with php 8 using stream input, json_decode, and mixed data types.
Learn to validate API endpoints in a PHP 8 restful app using the respect/validation library, set up a validation schema, handle exceptions, and return structured JSON errors.
Implement the missing arguments for the update method by passing a post body, adapt PHP type syntax, and prepare data access calls to update or remove users by UUID.
Set up git for the project, configure your name and email, and create a gitignore to exclude vendor and idea files; initialize the repository and make the initial commit.
Install composer packages just-http-status-codes and php-http-response-header to set status by code (like 400) and content type in a PHP 8 REST API.
Save your code on a git hosting platform such as GitHub by creating a new repository, adding a remote origin, and pushing your main branch with upstream tracking.
Refactor the update endpoint by moving payload validation into a dedicated validation class, using the respect validation library and constructor property promotion to streamline schema validation.
Install and integrate a uuid package to generate user IDs, wire it into the create user endpoint, and verify the uuid is assigned during a restful php 8 workflow.
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).
Implement a default response for the index root request using PHP 8, returning a 404 not found with a clear message and proper HTTP status handling.
Rewrite urls to friendly patterns with Apache, using access file and rewrite rules; map requests to index.php resource and then action, enabling readable endpoints for a PHP 8 RESTful API.
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.
Perform a focused codebase cleanup in the user service by removing samples, adopting the user entity with composer autoload, and replacing switch with PHP 8.1 match for cleaner logic.
Retrieve a user from the database using Red Bean PHP with uuid as id, employing bound parameters to prevent injection, returning the user or an empty array if not found.
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.
Implement a remove method in the user service to delete a user from the database with Red Bean PHP, validating the UUID and returning a boolean.
Implement a robust update method for a user in a PHP 8 REST API using Red Bean, handling optional fields, UUID validation, and error handling.
Refactor PHP enum usage in the user routes to streamline handling with tryFrom, returning null for unknown actions and centralizing not found logic.
Set and return proper HTTP status codes for every API endpoint in PHP 8, using 200, 201, 204, 400, 404, and 500, with header by code for consistent responses.
Develop clean code by writing self-descriptive functions and variables, avoid unnecessary comments, and refactor for clarity so the code speaks for itself.
Explore building a food item service in PHP 8 with Red Bean PHP, including retrieve, retrieve all, validation, and a dedicated food item data access layer and routes.
Refine api method validation by shifting http method checks from services to routes, using an http class and not-found exception to support a restful php 8 api.
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.
Move the hash_password routine into its own helper function, set a cost of 12 for secure password hashing, and wire it into the user service with proper inclusion and testing.
Build a robust restful API with PHP 8 by implementing a login endpoint that validates credentials, issues a JWT token, and configures securely via environment variables.
Store the JWT expiry time in the environment file to replace hard-coded values, using seconds (e.g., 3600 or 86400) for flexible token lifetimes and easier configuration.
Refactor the user data access layer by implementing a UserEntity, using unserialize and serialize for safe data handling, and exposing only needed fields to improve readability, consistency, and robustness.
Refactor the PHP 8 RESTful API by introducing a generic item entity to standardize product data (sequential ID, uuid, name, price, availability) and align with the user entity.
Learn how to store a JWT secret in a database by creating an API tokens table and a secret keys service in PHP 8, generating and persisting the key.
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.
Refactor the final API by adding try-catch error handling and a cannot login user exception. Centralize responses and move common validation to routes to reduce duplication and improve consistency.
Install PHPUnit as a dev dependency with composer, configure the phpunit.xml, and enable vendor autoload to start writing your first unit tests in the test folder.
Create and run unit tests for a user entity in a PHP 8 REST API, using final classes and strict types to verify getters, UUID handling, and serialize/unserialize.
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.
Explore frontend options for your PHP 8 RESTful API, from native apps to React Native and Flutter, and see how frontend clients connect to the MVP backend via endpoints.
Explore the architecture diagram for a PHP 8 REST API, outlining frontend devices and a server API, with RedBean PHP workflow to MySQL/MariaDB database, using JSON data exchange and Docker.
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!