Skip to content

Instantly share code, notes, and snippets.

@peterfox
Last active December 18, 2015 12:29
Show Gist options
  • Save peterfox/5783073 to your computer and use it in GitHub Desktop.
Save peterfox/5783073 to your computer and use it in GitHub Desktop.
A template for wrapping third party libraries that need to be used inside the framework but aren't compatible with the typical parameters required
<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
//Load this class with $this->load->library('CI_Something', $data, 'something');
require_once dir(__FILE__).'/Something/Something.php';
class CI_Something extends Something
{
public function __construct($config)
{
$expected = array('arguement1', 'arguement2', 'arguement3')
get_instance()->load->helper('array');
$config = elements($expected, $config);
parent::__construct($config['arguement1'], $config['arguement2'], $config['arguement3']);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment