I\'ve been following this guide (http://socialsemanticweb.blogspot.com.au/2012/11/zend-framework-2-create-custom-library.html) but I can\'t get Zend to see my library (error
First off, it's not a module, so the error message you get by adding it to the modules array of app config is to be expected.
Editing autoload_namespaces.php
to add your library (as you already have) should work.
That said, a more correct way is to add the autoload
key to your root composer.json file and do the mapping there
{
"require": {
"php": ">=5.3.3",
"zendframework/zendframework": ">2.2.0rc1"
},
"autoload": {
"psr-0": {"MyLibrary\\": "vendor/MyLibrary/library/"}
}
}
After doing that, from the command line run composer.phar update
, and it will automatically add your library to the autoload_namespaces file for you. Doing it that way means you don't have to manually edit the file every time you update your other libraries with composer.
To the error itself
Fatal error: Class 'Directory\Controller\MyLibaryController' not found in D:\work\eclipse\htdocs\directory\module\Directory\src\Directory\Controller\DirectoryController.php on line 17
I'm guessing that with autoloading taken care of, you're just missing a use
statement in your DirectoryController
class
<?php
namespace Directory\Controller;
// be sure to use your library controller
use MyLibrary\Mvc\Controller\MyLibraryController;
class DirectoryController extends MyLibraryController
{
//..
}