Laravel Classroom image

Anil  Bist / 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.

 

 
 
 
image
Anil  Bist

Skills    Laravel

Qualifications :- High School - SLV, College/University - Graphic Era Deemed Univ University,
Location :-Dehradun,Dehradun,Uttarakhand,India
Description:-

I started my Professional Journey in 2006 with one of the Web Development Company in Bangalore and my 1st framework was "Ruby on Rail" as Web development and delivered around 5+ Projects using this platform. Then came another dimension as JEE/Sturst framework, Gradually I realized that I want to build something on my own and give my passion and energy on creating something different a
Explore

 

  Students (0)