Welcome Guest, Not a member yet? Register   Sign In
[Plugin] CodeIgniterPhp5 (Autoloader, Modularity, Fast Coding)
#1

[eluser]Dewos[/eluser]
[h2]Advantages[/h2]

Code:
define('PROGRESS', 'less work for myself :)');

* Get Everything Everywhere: No more get_instance() for use CI inside model, library, helper, or view
* Lazy-load support: No more $this->load->something(). Resources automatically loads (only first time, only if needed)
* 100% Back\Forward CI Compatibility: All the logic work delegated to standard CI Core
* More concise syntax: Faster code typing style, better read style that make more sense. Bye bye $this->
* Non-obtrusive: If you wish, you can switch syntax modes, or even use them both. No refactor needed for "pre-plugin" code
* No core hacking is required: Simply download and load it just like any other plugin

[h2]Index[/h2]

* Userguide
* Changelogs
* Demonstration

* Download ver 1.8
#2

[eluser]hugle[/eluser]
Hello

Interesting approach.. But what about the overhead?
Have you done some tests etc?

Thanks
#3

[eluser]Phil Sturgeon[/eluser]
[quote author="hugle" date="1257778827"]Hello

Interesting approach.. But what about the overhead?
Have you done some tests etc?

Thanks[/quote]

There will be no real overhead at all, this is simply several wrapper functions acting as an alias with lazy-load support.

Meaning you call the model via these functions and it will load and return it for you.

My main problem with this, is that while it DOES cut out a few lines here and there, it means you have no persistant object. That's fine if your libs and models are just grouped logic acting like a bunch of lone-functions, but cuts out most of the point in using OOP in the first place.

You would end up needing to use code like:

Code:
$lib = Libaries('mylibrary')->do_something();
$lib->do_something_else();

Which would mean you need to start keeping track of the variables through the instance in your models, libs, controller, etc instead of having it all run from the super-global $this.

A good bit of code though, let me know if any of those assumptions are wrong.
#4

[eluser]Dewos[/eluser]
[quote author="hugle" date="1257778827"]Hello
Interesting approach.. But what about the overhead?
Have you done some tests etc?
[/quote]

Hugle relax, no (relevant) overhead Smile

[quote author="Phil" date="1257778827"]
A good bit of code though, let me know if any of those assumptions are wrong.
[/quote]

Hi Phil!
It's (almost) right if you choose to use the plugin as simple loader alias. But if you use it as general wrapper, then you're wrong:

Code:
# old way
$this->load->library('email');
$this->email->do_something();
$this->email->do_something_else();

# Simply Mode
$email = Libaries('email');
$email->do_something();
$email->do_something_else();

# Wrapper Mode
Libaries('email')->do_something();
Libaries('email')->do_something_else();

"Email library" is istanced only the first time (but you can use ci-name-alias if you need two istances).

Yes, the Wrapper Mode cut off many of "less-type" benefits, but the code is readable the same (more?) of codeingniter's "$THIS->UNKNOW_TYPE->" style (for me), and the lazy-load support is soo sweet.
#5

[eluser]Phil Sturgeon[/eluser]
I am a fan of lazy-loading, as I am very lazy.

I suppose if you need it persistently available to the CI instance it may just be a case of:

Code:
$this->email = Libaries('email');
$this->email->do_something();
$this->email->do_something_else();

I'll have a play with this at some point. It sure would be easier than my autoloading attempts (do not even try it with CI! >.<).
#6

[eluser]Dewos[/eluser]
1.3 Version Online (Final?)

Version 1.3 Changelog:
* Added more controls for downsize overhead
* Added Php5 Helpers Mode
* Added Plugin suffix

Php5 Helpers Mode is funny Smile
Code:
# old way
$this->load->helper('date');
echo now();

# new way
echo Helpers('date')->now();
#7

[eluser]Dewos[/eluser]
[quote author="Phil Sturgeon" date="1257789983"]I am a fan of lazy-loading, as I am very lazy.

I suppose if you need it persistently available to the CI instance it may just be a case of:

Code:
$this->email = Libaries('email');
$this->email->do_something();
$this->email->do_something_else();

I'll have a play with this at some point. It sure would be easier than my autoloading attempts (do not even try it with CI! >.<).[/quote]

Mmmm... But the library (and all) is always persistently to the CI instance.
#8

[eluser]Dewos[/eluser]
Version 1.4 Changelog:
* Added Langs()
* Added Modularity for Configs, Helpers, Langs (es. Configs(‘rss’)->line(‘ip’)Wink
* Libraries re-renamed in “Libs” by popular acclaim (lol)
* Added more and more and more controls for downsize overhead
* Better Docs
#9

[eluser]Dewos[/eluser]
edit
#10

[eluser]Dewos[/eluser]
Version 1.5 Changelog:
* Added Libs(‘uri’)->something(); support for CI parent instance
* Check Control for Core CI Libs Autoloaded (Uri, Input, Config etc…). Now more faster
* Created CI Wiki page




Theme © iAndrew 2016 - Forum software by © MyBB