PLATFORM
  • Tails

    Create websites with TailwindCSS

  • Wave

    Start building the next great SAAS

  • Pines

    Alpine & Tailwind UI Library

  • Auth

    Plug'n Play Authentication for Laravel

  • Designer comingsoon

    Create website designs with AI

  • DevBlog comingsoon

    Blog platform for developers

  • Static

    Build a simple static website

  • SaaS Adventure

    21-day program to build a SAAS

Creating a Simple PHP Router

Created on December 28, 2018

This video course will teach you the basics on creating a simple PHP router. Let's learn how to create a simple routing system with PHP. 


You can find the source code for this video course at https://github.com/thedevdojo/create-a-php-routing-system. You can find a breakdown of each episode below:

Creating the Index File - In the first video we will be creating our index file which is the main entry point for our router.

Mapping a Route to a File - In this video we’ll be showing you how you can map a route to a specific file.

Passing Arguments - In this video we will show you how you can make the route parameters pass arguments to a specific file or function.

Creating Our Route Class - In this video we will be separating our logic into a single Router class that we will then use to create our routes.

Mapping Routes in our Class - In this final video we will be showing you how to map a route to a specific file inside of our Router Class.


Thanks for watching! This was just a simple implementation on how to creating a PHP routing system. There are many more things that you will want to implement in this routing system. You will also want to create a 404 page when the route that someone is trying to access is not found. But in this series I just wanted to get you started and show you how to create a simple PHP Routing System :)

Comments (0)

loading comments

Creating the Index File

5 videos (12 minutes)

Autoplay?

0% completed
Now Playing 1. Creating the Index File
2. Mapping a Route to a File
3. Passing Arguments
4. Creating our Route Class
5. Mapping Routes in our Class
let checkoutBtns = document.getElementsByClassName("checkout"); for( var i=0; i < checkoutBtns.length; i++ ){ if(checkoutBtns[i].dataset.redirect){ redirectAfterPurchase = checkoutBtns[i].dataset.redirect; } checkoutBtns[i].addEventListener('click', openCheckout, false); } function openCheckout(e) { let checkoutButton = e.currentTarget; let productCheckout = parseInt('593446'); if(checkoutButton.dataset.product){ productCheckout = checkoutButton.dataset.product; } let couponCheckout = ''; if(checkoutButton.dataset.coupon){ couponCheckout = checkoutButton.dataset.coupon; } Paddle.Checkout.open({ product: productCheckout, email: '', successCallback: "checkoutComplete", coupon: couponCheckout, }); } let updateBtns = document.getElementsByClassName("update-account"); for( var i=0; i < updateBtns.length; i++ ){ updateBtns[i].addEventListener('click', updateAccount, false); } function updateAccount(){ Paddle.Checkout.open({ override: this.dataset.url, successCallback: "updateCancelComplete", }); } let cancelBtns = document.getElementsByClassName("cancel-account"); for( var i=0; i < cancelBtns.length; i++ ){ cancelBtns[i].addEventListener('click', cancelAccount, false); } function cancelAccount(){ Paddle.Checkout.open({ override: this.dataset.url, successCallback: "cancelComplete", }); } -->