Laravel Classroom image

Yasar  Khan / Professional / Web Technology

 
To post your Question Join Classroom
 
Lesson Topics's No:-  First|1 | 2 | 3 | 4|Last
Lessons:-Autoloading Classes

18.3 Namespace Mapping
PHP 5.3 saw the arrival of name-spacing. Although far from perfect, name-spacing allows the
PSR-0 convention of loading files. Under the PSR-0, namespaces are used to indicate directory
structure, and class names are used to identify the file name, therefore we can assume that..
1 <?php namespace Paladin\Mage;
2
3 class Princess
4 {
5 // so pretty
6 }
will live in the file..
paladin/mage/princess.php
Before we can use this convention, Laravel needs to know where our root namespace directory
is. We can help it find our files by using the namespaces() method of the Autoloader class, for
example..
1 <?php
2
3 Autoloader::namespaces(array(
4 'Paladin' => path('libraries').'paladin'
5 ));As you can see we pass an array to the method. The array key represents the name of the root
namespace, in this case Paladin and the and array value is used to indicate the root folder that
is matched by this namespace, in my example application/libraries/paladin.

 

 
 
 

Yasar  Khan

Skills    Laravel

Qualifications :-
Location :-Dehradun,Dehradun,Uttarakhand,India
Description:- Hi i am yasar working as web developer since last 3 years.
Explore
 

  Students (0)