I have som legacy code that broke after an update of a dependency class of my ex colleague's Handler class of the Cosenary Instagram Class using composer.
The former reference to include the class in the handler class was this:
namespace Acme\Instagram;
class Handler
{
/* GOT SOME USEFUL VARS HERE */
const API_URL = 'https://api.instagram.com/v1';
/**
* Initialize the library
*
* @param array $settings Contains our ClientId and upload dir
* @param string $root_dir The root of our application
*/
public function __construct( $settings, $root_dir = __DIR__ )
{
include_once $root_dir . '/vendor/cosenary/instagram/instagram.class.php'; //HERE WAS THE INCLUDE BEFORE
// THROW SOME EXCEPTIONS HERE IF SETTINGS MISSING ETC...
// New instance of the instagram class
$this->_instagram = new \Instagram($this->_clientId);
}
/* HANDLE SOM FUNCTIONS HERE */
}
And if I change the include_once to:
require_once $root_dir . '/vendor/cosenary/instagram/src/Instagram.php';
Then I get:
Fatal error: Class 'Acme\Instagram\Instagram' not found in
I guess I need to pass it in as a reference in the constructor but that means I need to rewrite a lot of code and there is probably 5-10 other projects that is depending on this Hanlder class. Is there a way to use the instagram class in this other class?
Tried moving out the include_once and:
use MetzWeb\Instagram\Instagram;
But no luck, any help or pointers i greatly appreciated.