PHP: Issue with namespaces and files required exist in subfolder -


this file tree:

/lib   |- /external     |- /email       |- /mandrill          |- templates.php          |- exceptions.php          |- // others files       |- mandrill.php 

(with mandrill.php under folder "email" , folder "mandrill" under folder "email")

i'm using f3 framework autoload function (http://fatfreeframework.com/routing-engine#thef3autoloader)

this autoload:

$f3->set('autoload','app/controllers/|app/models/|app/services/|lib/external/'); 

this mandrill.php:

<?php namespace email;  require_once 'mandrill/templates.php'; require_once 'mandrill/exports.php'; require_once 'mandrill/users.php'; require_once 'mandrill/rejects.php'; require_once 'mandrill/inbound.php'; require_once 'mandrill/tags.php'; require_once 'mandrill/messages.php'; require_once 'mandrill/whitelists.php'; require_once 'mandrill/ips.php'; require_once 'mandrill/internal.php'; require_once 'mandrill/subaccounts.php'; require_once 'mandrill/urls.php'; require_once 'mandrill/webhooks.php'; require_once 'mandrill/senders.php'; require_once 'mandrill/metadata.php'; require_once 'mandrill/exceptions.php';  class mandrill {  // stuff } 

and can start mandrill without problem ( $mandrill = new \email\mandrill();)

in templates.php have

<?php namespace email\mandrill;  class mandrill_templates {     public function __construct(mandrill $master) {         $this->master = $master;     } 

but error fatal error: class 'email\mandrill_templates' not found

if move templates.php @ same level of mandrill.php, changing path of require, error "move" exports.php , on.

so, question is: how use namespace(s) right? thank you!


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -