Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Class 'Zend\ServiceManager\AbstractPluginManager' not found in .../vendor/zendframework/zend-barcode/src/ObjectPluginManager.php #4

Closed
websafe opened this issue Jul 9, 2015 · 0 comments

Comments

@websafe
Copy link
Contributor

websafe commented Jul 9, 2015

Hello :-)

I was testing the examples shown on http://framework.zend.com/manual/current/en/modules/zend.barcode.creation.html but I was getting:

Fatal error: Class 'Zend\ServiceManager\AbstractPluginManager' not found
    in .../vendor/zendframework/zend-barcode/src/ObjectPluginManager.php on line 22

I've checked https://github.com/zendframework/zend-barcode/blob/master/composer.json and found:

    "suggest": {
        "zendframework/zend-servicemanager": "Zend\\ServiceManager component, required when using the factory methods of Zend\\Barcode.",
        "zendframework/zendpdf": "ZendPdf component"
    },

so I used another example, without ::factory, but there was still the same error:

Fatal error: Class 'Zend\ServiceManager\AbstractPluginManager' not found
    in .../vendor/zendframework/zend-barcode/src/ObjectPluginManager.php on line 22

This issue was fixed by modifying my composer.json by adding "zendframework/zend-servicemanager": "^2.5" in the require section.

My example code:

<?php
error_reporting(E_ALL);
ini_set('display_errors', 'On');

require 'vendor/autoload.php';

// Only the text to draw is required
$barcodeOptions = array('text' => 'ZEND-FRAMEWORK');

// No required options
$rendererOptions = array();

// Draw the barcode in a new image,
// send the headers and the image
Zend\Barcode\Barcode::render(
    'code39', 'image', $barcodeOptions, $rendererOptions
);

and the fixed composer.json:

{
    "name": "websafe/zendframework-zend-barcode-example",
    "description": "Just testing",
    "license": "BSD-3-Clause",
    "require": {
        "zendframework/zend-servicemanager": "^2.5",
        "zendframework/zend-barcode": "^2.5"
    }
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
1 participant