Welcome Guest, Not a member yet? Register   Sign In
Extending a framework (non-core) library
#4

(09-16-2018, 10:46 AM)ciadmin Wrote: You could specify your own driver in application/Config/App.php (~ line 184), eg App\Session\MySessionHandler which implements CodeIgniter\Session\SessionInterface or which overrides one of the existing Session handlers. I am not sure if it would be better/appropriate to have your code inside application/Libraries, or to place it inside application/Session.

OK, so specifying the driver in config/app is great for sessions, but what if it was one of the other libraries, like Email, or Log?

You've probably noticed I'm starting to ask questions about CI4, and it's because it's only in the last day that I've started looking at the docs and comparing it to CI3. I realize this isn't CI3, but for the multitude of people that have been using CI < 4 for the last 10 years, we're going to want to have some of these things explained.

I asked about sessions because my authentication package has been extending sessions so that I can simply know what the old session ID was if it was regenerated. You might not expect to need that value, unless you're syncing a session with service that is holding the session ID as an identifier for service access. With CI3 I did this:


PHP Code:
public function sess_regenerate$destroy FALSE )
{
    
$this->pre_regenerated_session_id $this->session_id;

    
$_SESSION['__ci_last_regenerate'] = time();
    
session_regenerate_id($destroy);

    
$this->regenerated_session_id $this->session_id;

    return 
$this->session_id;



But yes, I would like to hear from Lonnie, and see what he has to say about extending libraries.
Reply


Messages In This Thread
RE: Extending a framework (non-core) library - by skunkbad - 09-16-2018, 02:10 PM



Theme © iAndrew 2016 - Forum software by © MyBB