Caketwit - Twitter Like Service using CakePHP
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Caketwit - Twitter Like Service using CakePHP

on

  • 1,728 views

ICCM Europe 2013 Presentation: Do you want to build PHP websites faster? I think we all do. In this workshop, we will take a brief look at the CakePHP open-source PHP framework that makes this ...

ICCM Europe 2013 Presentation: Do you want to build PHP websites faster? I think we all do. In this workshop, we will take a brief look at the CakePHP open-source PHP framework that makes this possible. As we build a simple Twitter like service, called CakeTwit, on the CakePHP Framework, you will learn the benefits of using a framework in your development. CakePHP provides code generation, Model View Controller Architecture, helper libraries for faster development, and much more! If you want make programming a piece of cake, check out this workshop.

Statistics

Views

Total Views
1,728
Views on SlideShare
1,724
Embed Views
4

Actions

Likes
1
Downloads
6
Comments
0

2 Embeds 4

https://twitter.com 3
http://www.slashdocs.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Caketwit - Twitter Like Service using CakePHP Presentation Transcript

  • 1. CakeTwit Johnathan Pulos @ Missional DigeratiImage by Blog.SpoonGraphics.co.uk
  • 2. About Me Background PHP - 9 Yrs. Ruby - 4 Yrs. iOS - 2 Yrs.Twitter: @jpulosGithub: codemisEmail: johnathan@MissionalDigerati.org
  • 3. Missional Digerati Community of thinkers, designers and developerscommitted to leveraging technology to advance the pace of reaching every person on earth with the good news of Jesus Christ. Twitter: @M_Digerati Github: MissionalDigerati Website: MissionalDigerati.org
  • 4. Presentation Resources Code on Github: http://goo.gl/f6eWb
  • 5. Basic Ingredients
  • 6. Model View Controller Model - classes that handle business logic of data. Controller - traffic cop bet ween models and view. View - renders a presentation of modeled data. http://goo.gl/yRDaa
  • 7. Convention Over Configuration DB TABLES MODELS plural + underscored singular + CamelCased ex. cars, user_scores ex. Car, UserScore CONTROLLERS VIEWS plural + CamelCased + action name + ending in “Controller” underscored ex. CarsController, UserScoresController ex. add, view_user http://goo.gl/N2Nh0
  • 8. Create Read Update DeleteImage by IconEden.com
  • 9. <?phpApp::uses(AppController, Controller);class TweetsController extends AppController { public function index() { /** * Show All Tweets */ } public function view($id = null) { /** * Show an Existing Tweet */ } public function add() { /** * Add a New Tweet */ } public function edit($id = null) { /** * Edit an Existing Tweet */ } public function delete($id = null) { /** * Delete an Existing Tweet */ }}
  • 10. CakeTwit Development Environments XP Mac OSX Lion Windows XP MAMP 2.1.1 (mamp.info) WAMP 2.2E (wampser ver.com) PHP 5.4.4 PHP 5.4.3 Apache 2.2.22 Apache 2.2.2 MySQL 5.5.25 MySQL 5.5.24 Sequel Pro (sequelpro.com) PHPMyAdmin 3.5.1 Textmate (macromates.com) Sublime Text (sublimetext.com) Terminal Command LineImage by Blog.SpoonGraphics.co.uk & Icons by PinkMoustache.net
  • 11. CakeTwit Off Screen Preparation Get CakePHP 2.3 Beta - https://github.com/cakephp/cakephp/tags Create a Virtual Host Enable Mod Rewrite Create a Database Add PHP to System Path XP http://goo.gl/lKoOt http://goo.gl/om8K6Image by Blog.SpoonGraphics.co.uk & Icons by PinkMoustache.net
  • 12. Go Green!Image by DryIcons.com
  • 13. CakeTwit Go Green! NOTICE Notice (1024): Please change the value of Security.salt in app/Config/core.php to a salt value specific to your application [CORE/ Cake/Utility/Debugger.php, line 835] <?php /** * File: app/Config/core.php Change to Random Alphanumeric String * Line: 187 */ /** * A random string used in security hashing methods. */ Configure::write(Security.salt, DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi);Image by Blog.SpoonGraphics.co.uk
  • 14. CakeTwit Go Green! NOTICE Notice (1024): Please change the value of Security.cipherSeed in app/Config/core.php to a numeric (digits only) seed value specific to your application [CORE/Cake/Utility/Debugger.php, line 839] <?php /** Change to Random Numeric String * File: app/Config/core.php * Line: 192 (Digits Only) */ /** * A random numeric string (digits only) used to encrypt/decrypt strings. */ Configure::write(Security.cipherSeed, 76859309657453542496749683645);Image by Blog.SpoonGraphics.co.uk
  • 15. CakeTwit Go Green! NOTICE Your database configuration file is NOT present.app/Config/database.php.default app/Config/database.phpImage by Blog.SpoonGraphics.co.uk & Icons by PinkMoustache.net
  • 16. CakeTwit Go Green! NOTICE Your database configuration file is NOT present. <?php /** * File: app/Config/database.php */ class DATABASE_CONFIG { Set Your MySql Settings public $default = array( datasource => Database/Mysql, persistent => false, host => localhost, login => user, password => password, database => database_name, prefix => , //encoding => utf8, ); }Image by Blog.SpoonGraphics.co.uk
  • 17. Call Me Betty CrockerImage by DryIcons.com
  • 18. CakeTwit Naming Convention for Tweets DB TABLE MODEL t weets Tweet CONTROLLER TweetControllerImage by Blog.SpoonGraphics.co.uk & Icons by PinkMoustache.net
  • 19. CakeTwit Tweets Database Table Import SQL into Database - http://goo.gl/4MHJj CREATE TABLE `tweets` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `post` varchar(255) DEFAULT NULL, `author` varchar(255) DEFAULT NULL, `created` datetime DEFAULT NULL, `modified` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; INSERT INTO `tweets` (`id`, `post`, `author`, `created`, `modified`) VALUES (1,I LUV CakeTwit!!!,A Random Poet,2012-12-24 08:00:00,2012-12-24 08:00:00), (2,Give me another piece of Cake, Twit that is!,Poetic Justice,2012-12-23 08:00:00,2012-12-23 08:00:00);Image by Blog.SpoonGraphics.co.uk
  • 20. CakeTwit Bake the Tweet’s Model XP In Terminal on Command Line `cd` into the working directory `cd` into the working directory > app/Console/cake bake > appConsolecake bake Select “M” for model Select “M” for model Follow the interactive console Follow the interactive console For displayField select post For displayField select post Add a validation to post as Add a validation to post as “notempty” “notempty”Image by Blog.SpoonGraphics.co.uk & Icons by PinkMoustache.net
  • 21. CakeTwit Bake the Tweet’s Controller XP In Terminal on Command Line `cd` into the working directory `cd` into the working directory > app/Console/cake bake Controller > appConsolecake bake Controller Follow the interactive console Follow the interactive console Build the controller Build the controller interactively interactively No dynamic scaffolding No dynamic scaffolding Use basic class methods Use basic class methodsImage by Blog.SpoonGraphics.co.uk & Icons by PinkMoustache.net
  • 22. CakeTwit Bake the Tweet’s Views XP In Terminal on Command Line `cd` into the working directory `cd` into the working directory > app/Console/cake bake View > appConsolecake bake View Follow the interactive console Follow the interactive consoleImage by Blog.SpoonGraphics.co.uk & Icons by PinkMoustache.net
  • 23. The Real Van Gogh Visit your local website, and see your master piece!Image by DryIcons.com
  • 24. Other Benefits
  • 25. Model DataSource Data DataSources The link bet ween models and the source of data that models represent. MySql Sqlite Postgres SqlserverIcons by PinkMoustache.net & DefaultIcon.com http://goo.gl/dXzjq
  • 26. Models Behavior Behaviors Reusable logic for the models. A mixin with callbacks. Access Control List Translate Containable TreeIcons by PinkMoustache.net http://goo.gl/17M6G + http://goo.gl/44OhY
  • 27. Controllers Components Components Reusable logic for controllers. Security Cookies Sessions Authentication Access Control Lists Request Handling Emails PaginationIcons by PinkMoustache.net http://goo.gl/Mp2NO + http://goo.gl/i53PM
  • 28. Views Elements Layouts Helpers Helpers Presentational logic shared among views, elements, and layouts. Cache Pagination Text (Paginator) Form Time HTML RSS Javascript (JS) SessionIcons by PinkMoustache.net http://goo.gl/8Gl8c + http://goo.gl/F2Ju5
  • 29. Questions?Johnathan@MissionalDigerati.org