231,599 Installs and Counting! Get Sparks Now!
Hey! Keep up to date with the project through its beta and public launch by following @getsparks.
Tweet
A Quick Looks At Sparks (EllisLab Official Post)
March 11, 2012
from: codeigniter.com
The Top Sparks of 2011
December 31, 2011
from: codefury.net
CodeIgniter Starter Project − A Starting Point for Any CI Dev
December 12, 2011
from: github.com
NetTuts+ Tutorial for GetSparks
November 24, 2011
from: net.tutsplus.com
Integrates PHPActiveRecord into CodeIgniter. PHP5.3+
| Contributor | : machuga |
| : Log in to view | |
| Author Website | : http://matthewmachuga.com |
| Spark Website | : http://github.com/machuga/php-activerecord-spark |
| Repository Type | : git |
| Number of Installs | : 4,887 |
php tools/spark install -v0.0.2 php-activerecord
Or download this version manually:
Get php-activerecord-0.0.2.zip
PHPActiveRecord is an open source ORM library, largely based on Ruby on Rails' ActiveRecord.
This spark is used to easily integrate PHPActiveRecord into CodeIgniter 2.0+.
NOTE: PHPActiveRecord requires PHP5.3+, logging requires the PEAR Log library.
Navigate to the root of your CodeIgniter project and run
php tools/spark install php-activerecord
PHPActiveRecord will use the config/database.php file to determine your
database settings. It is capable of handling several connections, but will
default to your $active_group connection. You may change the connection any
model uses within the model itself.
PHPActiveRecord does not require you to define your database tables before use,
simply extend your model from the ActiveRecord\Model class and your model
will be ready for use (aside from any extra configuration you may want to add
later).
Examples, documentation, and help forums are available at http://phpactiverecord.org.
Create a table in your database named tests and give it some test
information, perhaps an id and a varchar column. Create at least one or two
records.
Create a new file in your models directory named 'Test.php'
Give model the following content:
<?php
class Test extends ActiveRecord\Model { }
Proceed to 'welcome.php' within your controllers directory
Within the index function, enter the following prior to the view being called
$this->load->spark('php-activerecord/0.0.2');
echo '<pre>'; var_dump(Test::all()); exit;
If you've followed the steps above, you should now see a print out of your object, with the class of your Model. Success! PHPActiveRecord is now ready for use!
If you'd like to enable logging and profiling, simply uncomment the
designated block from ./libraries/PHPActiveRecord.php beginning at
line 59.
If you use the Module Extensions HMVC, the model folders in each module will automatically be checked for models just as the regular model folder would.
PHPActiveRecord was created and is maintained by Kien La and Jacques Fuentes. I am not associated with the developers of this project, but love the work they've done and want to make it easily accessible to the CodeIgniter community.
This spark was created and is maintained by Matthew Machuga, is hosted on GitHub, and is made possible by the GetSparks team. Please support their project!
php tools/spark install -v0.0.1 php-activerecord
Or download this version manually:
Get php-activerecord-v0.0.1.zip