title: How do I implement custom Helpers in Code Igniter 4?
body: <p><strong><em>Found the solution, refer to my answer.</em></strong></p>
  
  <p>I've had a look through the <a href="https://codeigniter4.github.io/userguide/general/helpers.html" rel="nofollow noreferrer">documentation</a> for CI4 and have played around with the Autoload file, but I don't fully understand how to load my custom helper in CI4. </p>
  
  <p>My helper is very simple and is just called <code>customviews_helper.php</code> and it is located in <code>app/Helpers</code>. However, I have no clue of how to use it and load it. </p>
  
  <p>The code I've created looks like this:</p>
  
  <p><strong>customviews_helper.php</strong></p>
  
  <pre><code>class CustomViews {
      public static function generateMainView($name){
          $data = [
              'title' =&gt; $name,
              'view' =&gt; 'screens/'.$name,
          ];
          echo view('main', $data);
      }
  }
  </code></pre>
  
  <p><strong>Home.php</strong> (Controller)</p>
  
  <pre><code>class Home extends BaseController
  {
      public function index()
      {
          \CustomViews::generateMainView('Users');
      }
  }
  </code></pre>