How to use WhichBrowser as a library?? |
There is this plugin(WhichBrowser->www.whichbrowser.net) i want to use in my project. Sorry i can't use composer because my host doesn't allow it. This is how it goes by:
Code: <?php in my controller's index method: Code: $this->load->library('parse', $_SERVER['HTTP_USER_AGENT']);
Be Simple
![]()
I would create in a CodeIgniter style a library Which_browser. In its constructor I would put
Code: require_once APPPATH.'third_party/Parser-2.0.16/bootstrap.php'; Then I would see what methods this new library would need and I would instantiate the external class wherever it is necessary for implementation of these methods. (03-28-2016, 01:54 AM)ivantcholakov Wrote: I would create in a CodeIgniter style a library Which_browser. In its constructor I would put thanks for your reply. But can you hit a working sample code for me to understan you clearly?
Be Simple
![]()
For most simple usage the buildin user agent library is excelent. Have you tried using this or do you need a better detection rate in bot names for example?
https://www.codeigniter.com/userguide3/l...agent.html
@waptik
File: APPPATH/libraries/Which_browser.php Code: <?php defined('BASEPATH') OR exit('No direct script access allowed.'); (03-28-2016, 05:26 AM)ivantcholakov Wrote: @waptik Thanks man
Be Simple
![]()
I think, it depends on the API that is provided. For simple packages this approach is good.
For something more complex a unique approach would be needed maybe, I have not faced such case yet.
Here is a simpler approach for this package: https://github.com/felixgirault/multiplayer
Code: <?php defined('BASEPATH') OR exit('No direct script access allowed.'); It depends on how the package fits to CodeIgniter libraries way. |
Welcome Guest, Not a member yet? Register Sign In |