In EE I am trying to create a php class that will query an API. When I look at the documentation for creating your own library classes (here: https://docs.expressionengine.com/latest/development/legacy/libraries/creating-libraries.html) I see that it says this about storing the library:
Your library classes should be placed within your system/ee/user/addons/addon_name/libraries directory, as this is where ExpressionEngine will look for them.
I don't see this directory anywhere in my project. Out of exhaustion I tried creating it and made a test class (just copied the example from the documentation except with an echo in the method) and loaded it, which resulted in an error... which I was expecting.
This is in system/ee/user/addons/addon_name/libraries/Someclass.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Someclass {
public function some_method()
{
echo 'test';
}
}
With this in a template:
<?php
ee()->load->library('someclass');
ee()->someclass->some_method();
?>
This gives me a load error:
Error
Unable to load the requested class: someclass
At this point I'm not sure if I'm simply too tired and not understanding the documentation or if I'm in the Twilight Zone.
Can anyone clarify this for me? I would greatly appreciate it.