2
votes

I'm having an issue where zend framework is not finding a zend json class.

In my index controller I have the line:

use Zend\Json\Server\Server;

In my index action when I try to create an instance of the json server class with the line:

$server = new Server();

I get the following fatal error:

PHP Fatal error:  Class 'Zend\\Json\\Server\\Server' not found in /home/jonathan/code/issacrest/module/Application/src/Controller/IndexController.php on line 38

The error itself proves that the framework knows I'm trying to create an instance of the json server class so what gives?

2
update your composer.phar, - Gautam Rai
try with use \Zend\Json\Server\Server; - Gautam Rai
tried that and still the same. This just makes no sense because the include paths are correct, the files are in place, it should work?!? - stryker
Is your framework fully autoload via the autoload file ? - Greco Jonathan

2 Answers

0
votes

Assuming you’re using Composer to manage your project’s dependencies, you have to install zend-json-server package:

composer require zendframework/zend-json-server
0
votes

I feel rather foolish for this one. My project was simply not looking at the correct copy of the zend framework. I installed the complete framework using composer and it works now. Thanks for your time