Error using libraries in PHP

1

I'm trying to add the following:

require_once __DIR__.'/vendor/autoload.php';
require_once __DIR__.'/settings.php';
require_once __DIR__.'/resources.php';
require_once __DIR__.'/utils.php';

use Spire\Settings;
use Spire\Resources;
use Spire\Utils;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

use Silex\Application;

But the server returns me error where there is the use of the backslash ("\"). What is the configuration required for the server to recognize it correctly?

    
asked by anonymous 11.11.2014 / 07:59

2 answers

1

Namespaces are supported from version 5.3 of php, you are probably using an earlier version.

    
11.11.2014 / 14:00
2

The error occurs because of the use of Namespaces in your code.

Notice the use of the word use in your code. In this part of your application it is used to import the specific Namespace that will be used in your code.

As mentioned by Pope Charlie in comments, PHP supports Namespaces from version 5.3 only.

More information about Namespace:

link

    
11.11.2014 / 09:47