Welcome Guest, Not a member yet? Register   Sign In
How can I strip down CI?
#1

[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
#2

[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.
#3

[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
#4

[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
#5

[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.
#6

[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
#7

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

[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.
#9

[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
#10

[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




Theme © iAndrew 2016 - Forum software by © MyBB