Closed Luc45 closed 7 years ago
just copy a file from same folders, config, libraries, and models
dont put it on third party folder
you may just read Installation in readme in this repo
I don't think this was answered properly...
Sorry about that.
Should be able to accomplish it with:
$this->load->add_package_path(APPPATH.'third_party/ion_auth/');
$this->load->library('ion_auth');
Please reopen if this doesnt resolve your issue.
I placed everything in application/third_party/ion_auth. Then, all I did was moving the Auth controller from application/third_party/ion_auth/controller to application/controllers. Then in that controller I added this row before the library load:
$this->load->add_package_path(APPPATH.'third_party/ion_auth/');
It works, the request localhost/my_site/auth renders the login page back to my browser.
Ben, is this the correct way to do it?
Yep that's it 👍
Can't load the ion_auth library by using $autoload['libraries'] = array('ion_auth');
, when Installing Ion Auth by using third_party structure.
It will cause `A PHP Error was encountered Severity: Notice
Message: Undefined property: Controller_name::$db
Filename: models/Ion_auth_model.php
Line Number: 212`
So should use $this->load->library('ion_auth');
to load library on both $autoload['packages'] = array(APPPATH.'third_party/ion_auth');
(in application/config/autoload.php) and
$this->load->add_package_path(APPPATH.'third_party/ion_auth/');
(in controller) ways.
If anything wrong correct me, this solved my problem that noticed before (` Severity: Notice
Message: Undefined property: Controller_name::$db
Filename: models/Ion_auth_model.php
Line Number: 212`)
Thank you
@muhammedsafeer thanks for sharing. Would you mind submitting a PR with a documentation update on how to do this.
Your welcome @benedmunds, and I will try to submit PR but only after confirm that it is a error free method that I follow.
Sorry about that.
Should be able to accomplish it with:
$this->load->add_package_path(APPPATH.'third_party/ion_auth/'); $this->load->library('ion_auth');
what should i do if i want to load this library on autoload? i have tried this on autoload.php
$autoload['packages'] = array(APPPATH.'third_party/ion-Auth');
@Hasan-Almujtaba autoloading third party packages doesn’t seem to work in CodeIgniter. I’ve seen complaints about this for awhile now. One workaround that people use is to create another class, auto load that, and it’s only job is to loading in the third part class.
I'm new to CodeIgniter, and trying to load Ion Auth as a third party.
Here's what I did:
Copied Ion Auth to folder application/third_party/ion_auth
But see what happens when I try to load in my Controller:
application/controllers/Admin.php
After googling, I made a library to require third_party/ion_auth/libraries/ion_auth.php:
application/libraries/Ion_Auth_Loader.php
Now I can load Ion Auth on my controller, but I can't use it's models:
How can I make Ion Auth work as a third_party?