Ligthers Ligthers - 1 year ago 90
PHP Question

Using codeigniter library in a native Php Code

Silly question from a newbie user. Hope all is well first and I have a question. There are many codeiginter user that thinks that codeigniter is the best when coding in php. I don't blame them and totally respect their point of view. I have been a native Php programmer for sometime and I just wanted to ask if it is possible to use a codeigniter Library for my native Php project.

I tried researching but I guess no one actually tried over the net so I'm asking this one.

I was actually trying to use the encryption library of code igniter for my Pure php.

Is there a way for this?


Answer Source

As for php encryption, there are several encryption methods available. So don't limit yourself to CI's library. For example:

But as to your question, CI is released under the MIT license with the following limitation:

* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.

This gives you the freedom to do anything about it except for the condition above.

As to using the library:

You may copy the library here:

save as Enryption.php then create another php file:


function log_message($message)

function config_item($what)
    //just a placeholder...
$cipher = new CI_Encryption();
        'key' => $key
$plaintext = 'The quick brown fox';
$ciphertext = $cipher->encrypt($plaintext);

echo 'ciphertext: ' . $ciphertext . "\n";
echo 'plaintext: ' . $cipher->decrypt($ciphertext) . "\n";
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download