Pretty Good PracticesHow I use CodeIgniter to increase productivity
Who Am I?• Adam Jackett• @darkhouseca• Proudly Self/Community Taught
Pretty Good Practices• HMVC• Base Controllers• Migrations• CRUD Models• Form Models• ORM Models
HMVC• Modular Extensions by wiredesignz• https://bitbucket.org/wiredesignz/  codeigniter-modular-extensions-hmvc
HMVCSimple blog module structure
HMVCRoutes for admin panels
HMVCLoad a model from another module
HMVCRun a controller method from another moduleOr load a controller into a variable
Base ControllersTypical application/core setup
Base ControllersAdd this to the end of your config.php
Base ControllersMY_Controller.php
Base ControllersAdmin_Controller.php
Migrations• Easily upgrade or downgrade• Database agnostic• Version control
MigrationsCreate a users table
MigrationsCreate a roles table
MigrationsCreate a role users pivot table
MigrationsAdd constraints
MigrationsDown method
MigrationsAutomatic Migrations in Base Controller
CRUD Models• Jamie Rumbelow’s Base Model• https://github.com/jamierumbelow/  codeigniter-base-model
CRUD Models• get($id)• get_by($field, $value) //or array• get_many_by($field, $value) //or array• get_all()
CRUD Models• get($field, $value) //or id, or array• get_all($field, $value) //or array
CRUD ModelsObservers
CRUD ModelsFilters
Form Models• Form validation in a model just for that  form• Store options for select boxes, radio  buttons, etc.
Form Modelscore/Form_Model.php
Form Modelsuser_form_model.php
Form ModelsPassword reset
Form ModelsMultiple step forms
ORM Models• Doctrine• Datamapper• PHPActiveRecord• RedBean• NotORM• Eloquent
Thank You!
Upcoming SlideShare
Loading in …5
×

Pretty Good Practices/Productivity

1,343 views

Published on

Published in: Technology, Business
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,343
On SlideShare
0
From Embeds
0
Number of Embeds
344
Actions
Shares
0
Downloads
24
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Pretty Good Practices/Productivity

    1. 1. Pretty Good PracticesHow I use CodeIgniter to increase productivity
    2. 2. Who Am I?• Adam Jackett• @darkhouseca• Proudly Self/Community Taught
    3. 3. Pretty Good Practices• HMVC• Base Controllers• Migrations• CRUD Models• Form Models• ORM Models
    4. 4. HMVC• Modular Extensions by wiredesignz• https://bitbucket.org/wiredesignz/ codeigniter-modular-extensions-hmvc
    5. 5. HMVCSimple blog module structure
    6. 6. HMVCRoutes for admin panels
    7. 7. HMVCLoad a model from another module
    8. 8. HMVCRun a controller method from another moduleOr load a controller into a variable
    9. 9. Base ControllersTypical application/core setup
    10. 10. Base ControllersAdd this to the end of your config.php
    11. 11. Base ControllersMY_Controller.php
    12. 12. Base ControllersAdmin_Controller.php
    13. 13. Migrations• Easily upgrade or downgrade• Database agnostic• Version control
    14. 14. MigrationsCreate a users table
    15. 15. MigrationsCreate a roles table
    16. 16. MigrationsCreate a role users pivot table
    17. 17. MigrationsAdd constraints
    18. 18. MigrationsDown method
    19. 19. MigrationsAutomatic Migrations in Base Controller
    20. 20. CRUD Models• Jamie Rumbelow’s Base Model• https://github.com/jamierumbelow/ codeigniter-base-model
    21. 21. CRUD Models• get($id)• get_by($field, $value) //or array• get_many_by($field, $value) //or array• get_all()
    22. 22. CRUD Models• get($field, $value) //or id, or array• get_all($field, $value) //or array
    23. 23. CRUD ModelsObservers
    24. 24. CRUD ModelsFilters
    25. 25. Form Models• Form validation in a model just for that form• Store options for select boxes, radio buttons, etc.
    26. 26. Form Modelscore/Form_Model.php
    27. 27. Form Modelsuser_form_model.php
    28. 28. Form ModelsPassword reset
    29. 29. Form ModelsMultiple step forms
    30. 30. ORM Models• Doctrine• Datamapper• PHPActiveRecord• RedBean• NotORM• Eloquent
    31. 31. Thank You!

    ×