Welcome Guest, Not a member yet? Register   Sign In
How to use package composer in controller (jasig\phpcas))
#1

Hi everyone,
Sorry for my question but i'm struggling with an issu and i unable to reach the solution.
I'd like to use the "jasig\phpcas" package download with composer in my CI4.1.9 recently installed and obviously, i failed. How do i use a package in composer directory ? I thought all composer packages were autoloaded and available for use in controlers directly but when i call :
Code:
phpCAS::client('3.0','my-cas-url',443,'/cas')

The page crash and the log return : " Class "App\Controllers\phpCAS" not found...".
I'd tried to include the class php file from the composer dir or "use \jasig\phpcas" in the begining of my controler but i still have the same result, "phpCAS not found".

Sorry, i'm not an expert with the new CI4 and namspaces PHP. Is anyone can explain how to reach this purpose ?

Thx
Reply
#2

You are trying to access the phpCAS class in the context of the App\Controllers namespace.
That's why you're getting the error.

PHP Code:
// before class
use phpCas
// or use backslash
-> \phpCas::client() 
Reply
#3

(05-23-2022, 11:31 AM)iRedds Wrote: You are trying to access the phpCAS class in the context of the App\Controllers namespace.
That's why you're getting the error.

PHP Code:
// before class
use phpCas
// or use backslash
-> \phpCas::client() 

Thanks a lot !!
I think i've tried all the pattern but not only 'use phpCAS'... my bad.
It work's now.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB