![]() |
Dear all,
I installed the apereo/phpcas classes by means of Composer (which correctly appears in my vendor path: as directory App\ThirdParty\vendor\apereo\phpcas\source\CAS and file ...\source\CAS.php). Now I want to use this class in a custom library, so I added PHP Code: namespace App\Libraries; But I get the error: Class "apereo\phpcas" not found APPPATH/Libraries/Auth.php at line 10 7 public function __construct() 8 { 9 10 $this->cas = new phpCAS(); I'm rather new to Composer, but I believe Composer autoloading is active by default in CI4? Many thanks in advance for your help or helpfull links/tuts! Sincerely, Zeff (03-26-2024, 02:41 AM)Zeff Wrote: I'm rather new to Composer, but I believe Composer autoloading is active by default in CI4? Yes. It seems the phpCAS class is located in the global namespace. https://github.com/apereo/phpCAS/blob/ma...simple.php Try: PHP Code: use phpCAS; And PHP classnames are case-sensitive after all. So be careful for the case. (03-26-2024, 05:36 AM)kenjis Wrote:Dear kenjis,(03-26-2024, 02:41 AM)Zeff Wrote: I'm rather new to Composer, but I believe Composer autoloading is active by default in CI4? Thanks for your reply, but I'm now get 'Class "phpCAS" not found'... If I define: use apereo\phpCAS, I get 'Class "apereo\phpCAS" not found'. When using use apereo\CAS, the error is: 'Class "App\Libraries\phpCAS" not found' I don't get it... ![]() Cheers, Zeff
Cannot reproduce.
PHP Code: <?php I see "1.6.1".
Dear kenjis,
Thanks for your help. I tried just the easy test to use phpCAS in a controller, but when I try to instantiate ($cas =new phpCAS()) I still get 'Class "phpCAS" not found'. My ThirdParty/Vendor directory looks like (installed via Composer): ![]() My composer.json in CAS source directory looks like: ![]() Best regards, Zeff
It seems you moved the vendor directory. It is not the standard location.
You must configure CodeIgniter to work with Composer. (03-27-2024, 03:34 AM)kenjis Wrote: It seems you moved the vendor directory. It is not the standard location. I read https://codeigniter.com/user_guide/conce...cture.html and indeed, the vendor dir has to be at root level. I moved all content to a newly created \vendor dir and now it's working. Thank you for your kind help and solution! Best regards, Zeff |
Welcome Guest, Not a member yet? Register Sign In |