Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Store codeigniter libraries in sub folders

Tags:

codeigniter

Is it possible to store libraries in sub folders in codeigniter? For example would something like this work?

-libraries
---sub_folder1
-----someClass.php
---sub_filder2
-----someClass2.php

If it does how should I load and use these libraries?

like image 606
King Julien Avatar asked Jan 07 '12 08:01

King Julien


1 Answers

Library files can be stored in subdirectories within the main "libraries" folder, or within your personal application/libraries folder. To load a file located in a subdirectory, simply include the path, relative to the "libraries" folder. For example, if you have file located at:

libraries/flavors/chocolate.php

You will load it using:

$this->load->library('flavors/chocolate');

You may nest the file in as many subdirectories as you want.

Explained on the loader class manual page

https://codeigniter.com/user_guide/libraries/loader.html

like image 163
Ben Swinburne Avatar answered Oct 08 '22 18:10

Ben Swinburne