Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Kiosk / PHP

2,005 views

Published on

Kiosk is the PHP Library for both MongoDB + traditional RDB.

Published in: Technology
  • Be the first to comment

Kiosk / PHP

  1. 1. Kiosk / PHPThe Schema Layer for @basuke CTO https://github.com/basuke/kiosk
  2. 2. Schema is not Your Enemy
  3. 3. • @basuke• Mac / iPhone / Newton• PHP : 10+ years•• Pythonist
  4. 4. • http://www.kanshin.com/ 2001• AssistOn http://www.assiston.co.jp/ 2004• https://tabidachi.ana.co.jp/ 2006• http://app.rmbl.in/ 2009
  5. 5. Kiosk• PHP• Active Record• MongoDB• GitHub • https://github.com/basuke/kiosk
  6. 6. MongoDB (1)• • 2009 Twitter • Python • TokyoTyrant • 2010 5 MongoDB • MondoDB
  7. 7. MongoDB (2)• AssistOn • http://www.assiston.co.jp/ • • 2010 PostgreSQL • 2011 • • Lithium Kiosk
  8. 8. MongoDB• •• PHP Mongo •• •
  9. 9. • Running code is the only clue for the structure.• RDB• • •
  10. 10. PHP• MongoDB • •• $doc = $_POST; •
  11. 11. • • • { name: "Taro", age: 30, tags:["iPod", "MacBookAir"]} • { n:"Taro", a: 30, t:["iPod", "MacBookAir"]} • • $doc = $db->users->find(array(t=>iPod)); • $name = $doc[n]; • w
  12. 12. Kiosk• Active Record • PHP •• MongoDB • • •
  13. 13. Kiosk• CakePHP conditions • weight > => 50.0 •••• GitHub
  14. 14. Active RecordActiveRecord is "an object that wraps a row in adatabase table or view, encapsulates database accessand adds domain logic on that data". Fowler, 2003 http://www.martinfowler.com/books.html
  15. 15. Active Record••• MVC V C• PHP5
  16. 16. • collection and entity••••
  17. 17. configuration• bind• class User extends Kiosk { }• User::bind($source, array( ... ));
  18. 18. configuration (cont.)• PHP • Ruby• • User User
  19. 19. configuration (cont.)• Kiosk • Kiosk • ActiveRecord • Kiosk_find(User, array( ... )) • Kiosk_save($entity);
  20. 20. configuration (cont.)• PHP 5.3 • User::find • User_find
  21. 21. CRUD• User::create()• User::import()• User::find()• User::count()• $user->save()• $user->fetch()• $user->destroy()
  22. 22. configuration details•••
  23. 23. associations• DBRef •• typed column •• hasOne / hasMany pseudo column •
  24. 24. ••• Many to Many •
  25. 25. Migration!
  26. 26. •• RDB• RDB
  27. 27. Kiosk RDB ORM• PostgreSQL Sqlite MySQL pdo•• RDB+MongoDB•
  28. 28. PHP4 w•• User::find()• MongoDB • MongoDB PHP5
  29. 29. PHP4• • Exception • • •
  30. 30. Thankshttps://github.com/basuke/kiosk

×