• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to use third party library

#1
Hi,
This is maybe stupid question but I have no idea how to use third party library in my project?

I want to use http://mobiledetect.net/ library but I don't know where to put it and how to use it in my app? 
 
I tried to include it directly in my controlers but this is not correct way of doing it so please help with some instructions where to put such files?
Reply

#2
From the doc first you need to download Composer which will install it.

Once Composer is installed you need to run it from a terminal in the project root.

composer require mobiledetect/mobiledetectlib

Once installed just follow the rest of the instructions.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#3
(09-02-2020, 03:53 AM)InsiteFX Wrote: From the doc first you need to download Composer which will install it.

Once Composer is installed you need to run it from a terminal in the project root.

composer require mobiledetect/mobiledetectlib

Once installed just follow the rest of the instructions.

Tnx, but I forgot to metnion that I will not install it with composer, but manualy include in my project. I need to put mobileDetect.php somwhere and somehow include it in app....
Reply

#4
You do it like this: https://codeigniter.com/user_guide/conce...l#classmap

PHP Code:
$classmap = [
    
'MobileDetect' => APPPATH .'third_party/Mobile_Detect.php'
];

// Controller
new \MobileDetect

Depending on your needs, we kinda have it already built in:
https://codeigniter.com/user_guide/libra...l#isMobile
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.