Create websites with TailwindCSS
Design blocks for your website
Start building the next great SAAS
Alpine & Tailwind UI Library
Plug'n Play Authentication for Laravel
Create website designs with AI
Blog platform for developers
Build a simple static website
21-day program to build a SAAS
Upgrade your account to get access to all content.
Created on April 10th, 2017
In this video you will learn about PHP namespaces. You will learn why the are useful and how to use them.
If you have a file located at App\Ninja\Weapon.php you will probably want to give it a namespace like the following:
<?php
namespace App\Ninja;
class Weapon {
}
Then, if you need to create a new instance of this Weapon class you can do so with the following:
<?php
use App\Ninja\Weapon;
$weapon = new Weapon;
PHP namespaces allow us to include classes in our project with the same name and it allows us to organize our code and classes better.
314
Comments (1)