How to use PHP namespaces?

Hi all. Tell me how to cope with classes when processing through index.php? You know, a lot of online examples, but as always explain the base from which a little that is clear.
Interested in the situation when running the autoloader. How to register namespaces? That is, there is space foo\bar\User foo\bar\Admin foo\bar\Book of the bunch.
How to write code is not understood, but name to bring in index.php
use foo\bar\User foo\bar\Admin foo\bar\Book, ...
July 8th 19 at 12:06
2 answers
July 8th 19 at 12:08
Pages.php. Is in the folder Backend/Models

namespace Backend\Models;

use Common\Model\Model as BaseModel;

class Pages extends Model {

 protected $table = 'pages';

 protected $key;

 public function allPages() {

 while(!$rows = parent::findAll()){

 throw new \Exception('no articles');

 and so on......</code-->
July 8th 19 at 12:10
If index.php located in the same directory, where classes connect like this:

If index.php is in a subdirectory first change directory to the root, then connect classes:

In addition you need to follow standard naming and placement for classes:
the question was not that. The essence of the spaces. It is necessary to specify anything to use via the index or in the classroom. TS - Cheyanne commented on July 8th 19 at 12:13
Have you tried spl_autoload_register() ?
Ship classes.
Or do you think that all illiterate and after adding the class you need to add or delete in index.php? - Clementina_Jacobs commented on July 8th 19 at 12:16
: what are you stuck with the autoloader? The purpose of the other, repeat. The challenge classes are not as interesting as the announcement to use when autoloader. And with that we already have. - Cheyanne commented on July 8th 19 at 12:19

Find more questions by tags PHP