I am trying to create a library in ZF2 and really finding it tedious and difficult. My library will be used to perform tasks on images, no front end output. Having read as much as I can I have done the following process.

1. Created:

```
vendor/mycompany/mylibrary/library/mylibrary/mylibrary.php

```
2. Contents of `mylibrary.php`:

```
<?php

namespace mylibrary;

class mylibrary {

}

```
3. Added:

```
"autoload": {
    "psr-0":  {"mylibrary\\":"vendor/mycompany/mylibrary/library/mylibrary/"}
}   

```

to `composer.json`.
4. Ran composer:

```
`sudo php composer.phar update`

```

and had no errors and `autoload_namespaces.php` gets updated with the new namespace:

```
return array(
    'mylibrary\\' => array($vendorDir . '/mycompany/mylibrary/library/mylibrary'),
    'Zend\\' => array($vendorDir . '/zendframework/zendframework/library'),
    'ZendXml' => array($vendorDir . '/zendframework/zendxml/library'),
    'ZendPdf\\' => array($vendorDir . '/zendframework/zendpdf/library'),
);

```
5. Added:

`use mylibrary;`

to `IndexController.php`

and tried to instantiate the class:

```
public function indexAction()
{

    $mylibrary = new mylibrary();
    // .... etc etc 

```

I get an error:

```
Fatal error: Class 'mylibrary' not found in /the/root/to/my/site/module/Application/src/Application/Controller/IndexController.php on line 22

```

Please could somebody have a look at what I have done and maybe tell me how I can instantiate my class without this error?

Thanks in advance