I have an class called Alumno.class.php, locate in Root\Classes\Abm\Alumno.class.php. So this class header is:
/** * Gestiona las operaciones ABM del tipo de usuario alumno. * La clase no realiza validaciones, eso será labor del controlador. * @package AdminManantiales * @subpackage Abm * @author Ramiro Martínez D'Elía */ namespace AdminManantiales\Classes\Abm; class Alumno extends Usuario{ // Implement } Now, I need to use the class in a php script, and try with this:
use \AdminManantiales\Classes\Abm\Alumno as AbmAlumno; [...] // Proceso el alta. $alumno = new AbmAlumno(); $alumno->alta($_POST); $nombreCompleto = $alumno->toStr(); But it fails in the $alumno = new AbmAlumno(); line. With the next message:
Class 'AdminManantiales\Classes\Abm\Alumno' not found
How do I include correctly the class using the "use" keyword ?.
usedoes not import / include anything. You still have to require the file if you aren't using an autoloader.