PHP Fatal error: Class 'AlbumTest\Bootstrap' not found - php

I am learning framework2 and I am following this:
http://framework.zend.com/manual/2.0/en/user-guide/routing-and-controllers.html
But I'm getting this error:
PHP Fatal error: Class 'AlbumTest\Bootstrap' not found in
/home/ben/ZendSkeletonApplication/path/to/zf2-tutorial/module/Album/test/AlbumTest/Controller/AlbumControllerTest.php
on line 23

It sounds like a namespace problem. Most likely your controller is in the namespace AlbumTest but you called Bootstrap instead of \Bootstrap. The difference is the latter will look in the root of your namespace for that directory.

Related

php Uncaught Error: Class 'BitWasp\Bitcoin\Key\PrivateKeyFactory' not found

im trying to add a library to my php. I already downloaded all the files from composer but a fatal error happended. here is my code :
require_once('vendor/autoload.php');
use BitWasp\Bitcoin\Bitcoin;
use BitWasp\Bitcoin\Address\AddressCreator;
use BitWasp\Bitcoin\Key\PrivateKeyFactory;
use BitWasp\Bitcoin\Key\KeyToScript\Factory\P2pkhScriptDataFactory;
//Rest of my code
ERROR 1 -> Uncaught Error: Class 'BitWasp\Bitcoin\Key\PrivateKeyFactory' not found
ERROR 2 -> Class 'BitWasp\Bitcoin\Key\PrivateKeyFactory' not found
Shouldn't that namespace be BitWasp\Bitcoin\Key\Factory\PrivateKeyFactory?
See here https://github.com/Bit-Wasp/bitcoin-php/blob/1.0/src/Key/Factory/PrivateKeyFactory.php#L5

neo4j graphaware php-client: class not found

When I tray to access my neo4j-DB via Graphaware's php-client using http-protocol, I get the following error message:
Fatal error: Class 'GraphAware\Common\Result\AbstractRecordCursor' not found in ...
On the other hand when I'm using the bolt-protocol t says:
Fatal error: Uncaught Error: Call to undefined method GraphAware\Bolt\Result\Result::getResult() in...
At the beginning of my code I have used
require_once 'vendor/autoload.php';
use GraphAware\Neo4j\Client\ClientBuilder;
so I thought the classes should be autoloaded which is obviously not the case.
What's wrong?
I have solved this issue by replacing the respective syntax for queries of the example-files by one out of the README.

Fatal error: exactly/the/good/way/class not found

I got the Fatal Error:
Fatal error: Class 'app\Autoloader' not found in C:\wamp64\www\WE\index.php
In other words:
Fatal error: exactly/the/good/way/class not found
begin of my script index.php
<?php
use \app\Autoloader;
Autoloader::register();
Begin of my autoloader script:
namespace app;
class Autoloader{...}
Arborescence:
Racine local server
app
[...]
Autoloader.php
index.php
Why this fatal error ?? The way mentionned in the error php is right...
Thaks for help !
The use statement will need to have the class available first. Since you haven't added the autoloader, you'll have to require_once the PHP file containing the autoloader, then use the class to import it into your namespace.
After the autoloader is present, it will have the responsibility of finding and loading the classes as they're use'd.

Fatal error: Class 'phpseclib\Crypt\Base'

Getting this Error in php encription what to do please help
Fatal error: Class 'phpseclib\Crypt\Base' not found in /usr/share/php/phpseclib/Crypt/DES.php on line 55
Are you using the master branch of phpseclib? If so you need to use an autoloader. eg. https://raw.githubusercontent.com/composer/composer/master/src/Composer/Autoload/ClassLoader.php

PHP Fatal error: Class not found

I've a very strange issue. In one class "SMSNotifier" I have
require_once (__DIR__ . "/../InvitationNotifier.php");
[...]
class SMSNotifier extends InvitationNotifier {
[...]
}
this class is included in another script which is called from the cli. When calling this script I get
PHP Fatal error: Class 'InvitationNotifier' not found in [...]/include/classi/notifiche/notifiers/SMSNotifier.php on line 12
The strange thing is that if I replace the require_once with a require I get instead
PHP Fatal error: Cannot redeclare class InvitationNotifier in [...]/include/classi/notifiche/InvitationNotifier.php on line 11
What could be the issue here?
Thank you in advance for any thought. I've ran out of them...
I've continued trying to understand the issue and I've found out that there was a circular dependency. I've "cut it" down and the issue is gone. Hope this can help someone
You should not just be loading up files like it's 1990. Use Composer (PHP) and follow PSR-4 http://www.php-fig.org/psr/psr-4
composer.json
{
"autoload": {
"psr-4": {"InvitationNotifier\\": "lib/"}
}
}
index.php
require_once('autoload.php');

Categories