Welcome Guest, Not a member yet? Register   Sign In
Integrate third party library like unirest.io/php.html
#2

Figured this out through experimentation Smile

1) Download the Unirest repo.
2) Copy its src folder into your application/libraries, resulting in Unirest.php and the Unirest folder there.
3) Modify application/libraries/Unirest.php, adding a bogus class to make CI happy
Code:
<?php

require_once dirname(__FILE__) . '/Unirest/Exception.php';
require_once dirname(__FILE__) . '/Unirest/Method.php';
require_once dirname(__FILE__) . '/Unirest/Response.php';
require_once dirname(__FILE__) . '/Unirest/Request.php';
require_once dirname(__FILE__) . '/Unirest/Request/Body.php';

// bogus class to make CI happy
class Unirest {
}
4) You should now be able to use the conventional CI loader ... $this->load->library('unirest'); and then use the package per the Unirest docs Big Grin
Reply


Messages In This Thread
RE: Integrate third party library like unirest.io/php.html - by ciadmin - 03-21-2017, 09:32 PM



Theme © iAndrew 2016 - Forum software by © MyBB