CodeIgniter Forums
How can I strip down CI? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: How can I strip down CI? (/showthread.php?tid=5928)

Pages: 1 2


How can I strip down CI? - El Forum - 02-08-2008

[eluser]devtrench[/eluser]
I'm writing a mini application that I would like to distribute, but I don't think my app uses a lot of what codeigniter has by default.

Can anyone give me a suggestion as to what I can safely take out of the default install? I assume that if I'm not using certain helpers and classes that those could be removed to reduce the filesize of the entire app, but I don't really know what the dependencies are.

Thanks for your help!

James


How can I strip down CI? - El Forum - 02-08-2008

[eluser]Pascal Kriete[/eluser]
I'm sure you could take out some of the unused libraries and helpers, but I see no need to do so. PHP is serverside, so even if CI was 3GB it wouldn't slow down your load times. As it happens, CI is less than 3MB so anything you strip out would make a negligible difference. Also keeping all the libraries intact will prove to be beneficial if you ever want to add more features to your site.


How can I strip down CI? - El Forum - 02-08-2008

[eluser]devtrench[/eluser]
[quote author="inparo" date="1202508645"]3MB[/quote]

We'll the install without the guide is more around 1.5MB, and I'd really like to get it under 500k. I guess I'll just start taking things out.

Anybody else want to take a shot at answering this? Anybody else done this?

James


How can I strip down CI? - El Forum - 02-08-2008

[eluser]zdknudsen[/eluser]
It's quite simple actually. Scan through your files and make a list of the libraries/helpers/plugins your application uses. Then delete every library/helper/plugin not on that list.

A few of the libraries are required, mind:
* Benchmark
* Input
* Config
* Hooks
* Router
* URI
* Language
* Loader
* Controller
* Output


How can I strip down CI? - El Forum - 02-08-2008

[eluser]xadio[/eluser]
You could also strip all the comments and extra whitespace, but will require a external script. For instance Input.php
22.8KB original
11.2KB without comments
9.46KB without whitespace

Lastly, you could modify some of the required libraries like Benchmark (if you don't use them).

These are more drastic means though Smile. Do what Zach suggested first.


How can I strip down CI? - El Forum - 02-08-2008

[eluser]Unknown[/eluser]
Well, if you don't mind modifying the core you can take it one step further than suggested by Zacharias Knudsen.

* Config
* Router
* URI
* Loader
* Controller
* Output

This leaves you with the core functions only to make CodeIgniter run.

For curiosity I'd strip down the lastest version leaving only:

* /index.php
* /system/application
* /system/database
* /system/CodeIgniter.php
* /system/Common.php
* /system/Config.php
* /system/Controller.php
* /system/Exceptions.php
* /system/Loader.php
* /system/Model.php
* /system/Output.php
* /system/Router.php
* /system/URI.php

About 389 KB in size Smile


How can I strip down CI? - El Forum - 02-08-2008

[eluser]devtrench[/eluser]
now these are great replys - thanks everyone Smile


How can I strip down CI? - El Forum - 02-08-2008

[eluser]Derek Allard[/eluser]
Actually, please don't strip out all comments and redistribute, as it would violate the license. That said, I fully endorse the suggested solution of just removing any unused libraries and helpers.


How can I strip down CI? - El Forum - 02-09-2008

[eluser]xadio[/eluser]
[quote author="Derek Allard" date="1202520411"]Actually, please don't strip out all comments and redistribute, as it would violate the license. That said, I fully endorse the suggested solution of just removing any unused libraries and helpers.[/quote]

Sorry for suggesting such. I wasn't thinking. Sad


How can I strip down CI? - El Forum - 02-09-2008

[eluser]tonanbarbarian[/eluser]
why not create an installation file in php that downloads CI and installs it instead.
That way your installation is as small as possible
and you can ensure the app is installed correctly
more work but better in the long run