Skip to content
Advertisement

Tag: autoload

PHP classes in namespaces not found

I tried to load a utility class to my main class with a namespace but everytime I try to run it it seems to not be working as in not finding the class. The error I got is: The first array is for me to check what files is included using the get_included_file() function and I have loaded my autoload.php

PHP autoloading namespace on xampp

I am trying to autoload php class under namespace on xampp. But for some reason it cannot find class under its absolute path. here is my autoloader: here is my class This is my file system: This i error i am getting: Warning: require_once(C:/xampp/htdocs/app/admin/modules/smartForm/smartForm.php): Failed to open stream: No such file or directory in C:xampphtdocsphpsmartfromappsystemautoLoader.php on line 3 Answer Looks

PHP autoload with namespaces do not load file

I have an issue with my autoloader and namespaces. Below the autoloader Below the index file The file for the class Person is saved in the directory root->include->Person I used the namespace in the class file like this If I visit the index file in the browser it returns ‘Class file not found’. Do I use the namespace correctly? Answer

How to access packages in vendor directory

Calling any package from the vendor directory structure within any CakePHP controller works, as the composer set up everything correctly. For example this MCVE from https://github.com/giggsey/libphonenumber-for-php#quick-examples When I run the equal code directly in webroot/sample.php so it fails : Got error ‘PHP message: PHP Fatal error: Uncaught Error: Class ‘libphonenumberPhoneNumberUtil’ not found in …sample.php My question: What do I have

Class FooBarBaz located in ./foo/bar/utility/baz.php does not comply with psr-4 autoloading standard. Skipping

When running composer’s update, install, require, dump-autoload, etc.; I suddenly start getting a yellow deprecation notice that says: Class FooBarBaz located in ./foo/bar/utility/baz.php does not comply with psr-4 autoloading standard. Skipping. Before Composer 2.0, one used to get: Deprecation Notice: Class FooBarBaz located in ./foo/bar/Baz.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0.

How to autoload custom annotation classes without using AnnotationRegistry?

I’m using Doctrine Annotations library (not the whole Doctrine, only annotations) and want to make a custom annotation class. composer.json: index.php: entities/MyClass.php annotations/TestAnnotation.php It gives me the following error: The only solution i found on the Internet is to use AnnotationRegistry::registerLoader or something similar, but it is deprecated so i’d like to solve the problem in another way. Answer One

Advertisement