SlideShare a Scribd company logo
1 of 36
talk about lithium
 cakephper   lithium




                       2012/01/06
lithium

post

lithium
noppoman722


:23




         java
cakephp                        Nate Abele   cake
    phpFW                           cakephp3.0
                     cakephp


php5.3




                 (                                 static
  call       )


         mongoDB     CouchDB


                           0.10
                 6
2
                   git clone
li3              (cake             bake)


      http://sourceforge.net/projects/li3/files/
       lithium                      webroot
webroot


li3
http://koo.moo.jp/blog/2010/10/24/lithium-tutorial-1/
lithium
(http://localhost/lithium/)
lthium
resouce                            (log                 templates       )
DB


                        (cake               routes)


DB                (                                       )
mysql mongoDB                 CouchDB sqlite3
                               (                                    )
Apc File          Memcache             Memory Redis     XCache


                  DB
DB      MongoDB                                 APC
(*apc                                                                       )

mongo
Mac : http://d.hatena.ne.jp/yohxx/20110130/1296396115
Cent OS : http://blog.mamemomonga.com/item/460
POST
database configuration
 app/lithium/bootstrap/connections.php

 //mongoDB setting
 Connections::add(‘dev_mongo’
   , array(
        ‘type’ => ‘MongoDb’
     , ‘host’ => ‘localhost’
     , ‘database’ => ‘posts’
 ));


cake
model
app/models/Post.php

<?php
namespace appmodels;
class Post extends lithiumdataModel {}

lithium   model
controller
app/controllers/PostsController.php

namespace appcontrollers;         ←                  (java    package    )
use appmodelsPost;               ←                            (java    import   )


class PostsController extends lithiumactionController {     ←



 public function index() {
! $posts = Post::all(); ←MongoDB                        post
!       return compact('posts');
    }

    public function add() {
!     $success = false;
!     if ($this->request->data) {
!       $post = Post::create($this->request->data);
!       $success = $post->save();
!     }
!     return compact('success');
    }
}
view
app/views/posts/index.html.php (                                 )

<?php foreach($posts as $post): ?>
  <article>
    <h1><?=$post->title ?></h1>
    <p><?=$post->body ?></p>
  </article>
<?php endforeach; ?>
<?=$this->html->link('add','/posts/add'); ?>



app/views/posts/post.html.php
<?php if ($success): ?>
<p>Post Successfully Saved</p>
<?php endif; ?>
<?=$this->form->create(); ?>
  <?=$this->form->field('title');?>
  <?=$this->form->field('body', array('type' => 'textarea'));?>
  <?=$this->form->submit('Add Post'); ?>
<?=$this->form->end(); ?>
<?=$this->html->link('index','/posts/index'); ?>



twig smarty                        cake                              cake
MVC
      (http://localhost/posts/index)
POST!

        $post = Post::create($this->request->data);

        lithiumdataentityDocument


        $post->save();
        (json                                 mongo
                            )


          mongo
mongo
MongoDB
cake
                                php




 controller            render                 (     )


              Component


               DB


 view               .ctp          .html.php


                           Cool (cake         ww)


 cake
lithium
lithium                                       Chain of Respnsibility
            lithium




lithium




Chain of Respnsibility



J2EE         SERVLET          Filter




          (wiki)
http://ja.wikipedia.org/wiki/Chain_of_Responsibility_%E3%83%91%E3%82%BF%E3%83%BC%E3%83%B3
Filter
lithiumactionDispatcher::applyFilter()



app/webroot/index.php

<?php

//log
lithiumanalysisLogger::config(array('default' => array('adapter' => 'File')));

$debugMessage = __FUNCTION__ . __LINE__;
lithiumactionDispatcher::applyFilter('run',
!     function($self, $params, $chain) use ($debugMessage) {
!     !   lithiumanalysisLogger::debug($debugMessage);          //
!    !   $res = $chain->next($self, $params, $chain);              //
!    !   return $res;
!    }
);

echo lithiumactionDispatcher::run(new lithiumactionRequest());


(lithiumcoreStaticObject::$_methodFilters                               key
Dispatcher::run                                             )

lithium
http://www.1x1.jp/blog/2010/10/lithium_filter_system.html
cake   controller
render
lithiumactionController.php
protected $_render = array(
          !   !    'type'      => null,
          !   !    'data'      => array(),
          !   !    'auto'      => true,
          !   !    'layout'    => 'default',
          !   !    'template'   => null,
          !   !    'hasRendered' => false,
          !   !    'negotiate' => false
          !   );


cake          $this->layout     $this->autoRender


lithiumactionController->render()
$this->autoRender = false;
$this->layout = ‘default’;
$this->set(‘key’,‘val’);

  lithium
$this->render(array(‘auto’ => false, ‘layout’ => ‘default’, ‘data’ =>
compact(‘hogehoge’)));
cakephp
    beforeFiter() _init()


    uses    helpers components


    log           $this->log     lithiumanalysisLogger::debug()




*          cake                        AppController.php



     AppController.php           $this->log()
cake   model
controller



cakephp
$this->primaryKey = “hogehoge”;
$this->useDbConfig = “sample”;

lithium
$this->config(‘key’ => ‘hogehoge’, ‘connection’ => ‘sample’);

$_meta                        config()
*primarykey       id
mysql
app/config/bootstrap/connections.php

Connections::add(“dev_mysql_master”
   , array(
          ‘type‘    => ‘database’
       , ‘adapter‘ => ‘Mysql’
       , ‘host‘     => ‘localhost’
       , ‘login‘    => ‘user’
       , ‘password’ => ‘pass’
       , ’database’ => ‘sampledb’
       ));

app/models/hogehoge.php

$this->config(‘key’ => ‘hogehoge’, ‘connection’ => ‘dev_mysql_maseter’);   ←   Mysql


public static function getAll(){
   function args(){
      $fields = array(‘id’, ‘title’);
      $condtions = array(‘id’ => 10);
      $offset = 3;
      $order = array(‘created’ => ‘desc’);
      return compact('fields', 'conditions', 'limit', 'offset', 'order')
   };
   return lithiumdataModel::find('all', $args())->to('array');
}
cakephp
  beforeFiter() _init()


                    model                               static


  Mysql                       PEAR      mysql             (PDO mysqli   )


  $this->query()


$db = Connections::get($self::meta('connection')); //
$db->read('SELECT * FROM post', array('return' => 'array'));
 
model               AppModel.php


     AppModel.php
_init()               mysql mongo
cake


php5.3



mongo    couchDB


              staticObject
Talkaboutlithium

More Related Content

What's hot

Lithium: The Framework for People Who Hate Frameworks, Tokyo Edition
Lithium: The Framework for People Who Hate Frameworks, Tokyo EditionLithium: The Framework for People Who Hate Frameworks, Tokyo Edition
Lithium: The Framework for People Who Hate Frameworks, Tokyo EditionNate Abele
 
Speed up your developments with Symfony2
Speed up your developments with Symfony2Speed up your developments with Symfony2
Speed up your developments with Symfony2Hugo Hamon
 
How to use MongoDB with CakePHP
How to use MongoDB with CakePHPHow to use MongoDB with CakePHP
How to use MongoDB with CakePHPichikaway
 
Introduction to CloudForecast / YAPC::Asia 2010 Tokyo
Introduction to CloudForecast / YAPC::Asia 2010 TokyoIntroduction to CloudForecast / YAPC::Asia 2010 Tokyo
Introduction to CloudForecast / YAPC::Asia 2010 TokyoMasahiro Nagano
 
Doctrine MongoDB ODM (PDXPHP)
Doctrine MongoDB ODM (PDXPHP)Doctrine MongoDB ODM (PDXPHP)
Doctrine MongoDB ODM (PDXPHP)Kris Wallsmith
 
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-Tsuyoshi Yamamoto
 
The Zen of Lithium
The Zen of LithiumThe Zen of Lithium
The Zen of LithiumNate Abele
 
Redis for your boss 2.0
Redis for your boss 2.0Redis for your boss 2.0
Redis for your boss 2.0Elena Kolevska
 
News of the Symfony2 World
News of the Symfony2 WorldNews of the Symfony2 World
News of the Symfony2 WorldFabien Potencier
 
Silex meets SOAP & REST
Silex meets SOAP & RESTSilex meets SOAP & REST
Silex meets SOAP & RESTHugo Hamon
 
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐいHisateru Tanaka
 
4069180 Caching Performance Lessons From Facebook
4069180 Caching Performance Lessons From Facebook4069180 Caching Performance Lessons From Facebook
4069180 Caching Performance Lessons From Facebookguoqing75
 
PHP 5.3 and Lithium: the most rad php framework
PHP 5.3 and Lithium: the most rad php frameworkPHP 5.3 and Lithium: the most rad php framework
PHP 5.3 and Lithium: the most rad php frameworkG Woo
 
Get into the FLOW with Extbase
Get into the FLOW with ExtbaseGet into the FLOW with Extbase
Get into the FLOW with ExtbaseJochen Rau
 
Ansible leveraging 2.0
Ansible leveraging 2.0Ansible leveraging 2.0
Ansible leveraging 2.0bcoca
 
第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」
第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」
第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」Tsuyoshi Yamamoto
 

What's hot (20)

Current state-of-php
Current state-of-phpCurrent state-of-php
Current state-of-php
 
CodeIgniter 3.0
CodeIgniter 3.0CodeIgniter 3.0
CodeIgniter 3.0
 
Lithium: The Framework for People Who Hate Frameworks, Tokyo Edition
Lithium: The Framework for People Who Hate Frameworks, Tokyo EditionLithium: The Framework for People Who Hate Frameworks, Tokyo Edition
Lithium: The Framework for People Who Hate Frameworks, Tokyo Edition
 
Speed up your developments with Symfony2
Speed up your developments with Symfony2Speed up your developments with Symfony2
Speed up your developments with Symfony2
 
How to use MongoDB with CakePHP
How to use MongoDB with CakePHPHow to use MongoDB with CakePHP
How to use MongoDB with CakePHP
 
Introduction to CloudForecast / YAPC::Asia 2010 Tokyo
Introduction to CloudForecast / YAPC::Asia 2010 TokyoIntroduction to CloudForecast / YAPC::Asia 2010 Tokyo
Introduction to CloudForecast / YAPC::Asia 2010 Tokyo
 
Doctrine MongoDB ODM (PDXPHP)
Doctrine MongoDB ODM (PDXPHP)Doctrine MongoDB ODM (PDXPHP)
Doctrine MongoDB ODM (PDXPHP)
 
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
 
The Zen of Lithium
The Zen of LithiumThe Zen of Lithium
The Zen of Lithium
 
Redis for your boss 2.0
Redis for your boss 2.0Redis for your boss 2.0
Redis for your boss 2.0
 
News of the Symfony2 World
News of the Symfony2 WorldNews of the Symfony2 World
News of the Symfony2 World
 
Silex meets SOAP & REST
Silex meets SOAP & RESTSilex meets SOAP & REST
Silex meets SOAP & REST
 
Alfredo-PUMEX
Alfredo-PUMEXAlfredo-PUMEX
Alfredo-PUMEX
 
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい
 
4069180 Caching Performance Lessons From Facebook
4069180 Caching Performance Lessons From Facebook4069180 Caching Performance Lessons From Facebook
4069180 Caching Performance Lessons From Facebook
 
Redis for your boss
Redis for your bossRedis for your boss
Redis for your boss
 
PHP 5.3 and Lithium: the most rad php framework
PHP 5.3 and Lithium: the most rad php frameworkPHP 5.3 and Lithium: the most rad php framework
PHP 5.3 and Lithium: the most rad php framework
 
Get into the FLOW with Extbase
Get into the FLOW with ExtbaseGet into the FLOW with Extbase
Get into the FLOW with Extbase
 
Ansible leveraging 2.0
Ansible leveraging 2.0Ansible leveraging 2.0
Ansible leveraging 2.0
 
第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」
第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」
第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」
 

Viewers also liked

Instructions AIMPOINT CompM4, 3XMag | Optics Trade
Instructions AIMPOINT CompM4, 3XMag | Optics TradeInstructions AIMPOINT CompM4, 3XMag | Optics Trade
Instructions AIMPOINT CompM4, 3XMag | Optics TradeOptics-Trade
 
87 paper battery
87 paper battery87 paper battery
87 paper batterymuni kanth
 
Mendeleyev cedveli mbm
Mendeleyev cedveli mbmMendeleyev cedveli mbm
Mendeleyev cedveli mbmMirNamik
 
CFD Analysis of a Cyclone Seperator
CFD Analysis of a Cyclone SeperatorCFD Analysis of a Cyclone Seperator
CFD Analysis of a Cyclone Seperatorijsrd.com
 
Polymer/Ionic Liquid Electrolytes and Their Potential in Lithium Batteries
Polymer/Ionic Liquid Electrolytes and Their Potential in Lithium BatteriesPolymer/Ionic Liquid Electrolytes and Their Potential in Lithium Batteries
Polymer/Ionic Liquid Electrolytes and Their Potential in Lithium BatteriesFuentek, LLC
 
Paper battery 112&24
Paper battery 112&24Paper battery 112&24
Paper battery 112&24dekkasampath
 
PP Battery Separator for Lithium-Ion Battery Manufacturing
PP Battery Separator for Lithium-Ion Battery ManufacturingPP Battery Separator for Lithium-Ion Battery Manufacturing
PP Battery Separator for Lithium-Ion Battery ManufacturingTargray
 
Presenting u about paper battery
Presenting u about paper batteryPresenting u about paper battery
Presenting u about paper batteryGrishma Rao
 
Polymeric materials for organic solar cells
Polymeric materials for organic solar cellsPolymeric materials for organic solar cells
Polymeric materials for organic solar cellsNeslihan Yagmur
 
Jyoth ir mai-paper battery
Jyoth ir mai-paper batteryJyoth ir mai-paper battery
Jyoth ir mai-paper batteryJyothirmai Jyo
 
Piezoelectric energy assisted car
Piezoelectric energy assisted carPiezoelectric energy assisted car
Piezoelectric energy assisted carBiswajit Pratihari
 
Paper battery
Paper batteryPaper battery
Paper batteryRiyas K H
 

Viewers also liked (20)

Layouts
LayoutsLayouts
Layouts
 
Instructions AIMPOINT CompM4, 3XMag | Optics Trade
Instructions AIMPOINT CompM4, 3XMag | Optics TradeInstructions AIMPOINT CompM4, 3XMag | Optics Trade
Instructions AIMPOINT CompM4, 3XMag | Optics Trade
 
87 paper battery
87 paper battery87 paper battery
87 paper battery
 
Mendeleyev cedveli mbm
Mendeleyev cedveli mbmMendeleyev cedveli mbm
Mendeleyev cedveli mbm
 
CFD Analysis of a Cyclone Seperator
CFD Analysis of a Cyclone SeperatorCFD Analysis of a Cyclone Seperator
CFD Analysis of a Cyclone Seperator
 
Electric Vehicle University - 210a EV BATTERY TECHNOLOGY
Electric Vehicle University - 210a EV BATTERY TECHNOLOGYElectric Vehicle University - 210a EV BATTERY TECHNOLOGY
Electric Vehicle University - 210a EV BATTERY TECHNOLOGY
 
Polymer/Ionic Liquid Electrolytes and Their Potential in Lithium Batteries
Polymer/Ionic Liquid Electrolytes and Their Potential in Lithium BatteriesPolymer/Ionic Liquid Electrolytes and Their Potential in Lithium Batteries
Polymer/Ionic Liquid Electrolytes and Their Potential in Lithium Batteries
 
Paper battery 112&24
Paper battery 112&24Paper battery 112&24
Paper battery 112&24
 
Ultracapacitors
UltracapacitorsUltracapacitors
Ultracapacitors
 
PP Battery Separator for Lithium-Ion Battery Manufacturing
PP Battery Separator for Lithium-Ion Battery ManufacturingPP Battery Separator for Lithium-Ion Battery Manufacturing
PP Battery Separator for Lithium-Ion Battery Manufacturing
 
Lithium ion battery
Lithium ion batteryLithium ion battery
Lithium ion battery
 
Lithium
LithiumLithium
Lithium
 
Presenting u about paper battery
Presenting u about paper batteryPresenting u about paper battery
Presenting u about paper battery
 
Polymeric materials for organic solar cells
Polymeric materials for organic solar cellsPolymeric materials for organic solar cells
Polymeric materials for organic solar cells
 
Jyoth ir mai-paper battery
Jyoth ir mai-paper batteryJyoth ir mai-paper battery
Jyoth ir mai-paper battery
 
Ppo Presentation
Ppo PresentationPpo Presentation
Ppo Presentation
 
Piezoelectric energy assisted car
Piezoelectric energy assisted carPiezoelectric energy assisted car
Piezoelectric energy assisted car
 
Paper battery
Paper batteryPaper battery
Paper battery
 
Alkaline Battery
Alkaline BatteryAlkaline Battery
Alkaline Battery
 
Lithium
LithiumLithium
Lithium
 

Similar to Talkaboutlithium

Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryRemedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryTatsuhiko Miyagawa
 
Ch ch-changes cake php2
Ch ch-changes cake php2Ch ch-changes cake php2
Ch ch-changes cake php2markstory
 
Facebook的缓存系统
Facebook的缓存系统Facebook的缓存系统
Facebook的缓存系统yiditushe
 
PHP and Rich Internet Applications
PHP and Rich Internet ApplicationsPHP and Rich Internet Applications
PHP and Rich Internet Applicationselliando dias
 
Bootstrat REST APIs with Laravel 5
Bootstrat REST APIs with Laravel 5Bootstrat REST APIs with Laravel 5
Bootstrat REST APIs with Laravel 5Elena Kolevska
 
Psgi Plack Sfpm
Psgi Plack SfpmPsgi Plack Sfpm
Psgi Plack Sfpmsom_nangia
 
Psgi Plack Sfpm
Psgi Plack SfpmPsgi Plack Sfpm
Psgi Plack Sfpmwilburlo
 
Debugging: Rules And Tools - PHPTek 11 Version
Debugging: Rules And Tools - PHPTek 11 VersionDebugging: Rules And Tools - PHPTek 11 Version
Debugging: Rules And Tools - PHPTek 11 VersionIan Barber
 
Rails 3 overview
Rails 3 overviewRails 3 overview
Rails 3 overviewYehuda Katz
 
Debugging: Rules & Tools
Debugging: Rules & ToolsDebugging: Rules & Tools
Debugging: Rules & ToolsIan Barber
 
How to replace rails asset pipeline with webpack?
How to replace rails asset pipeline with webpack?How to replace rails asset pipeline with webpack?
How to replace rails asset pipeline with webpack?Tomasz Bak
 
PHP Data Objects
PHP Data ObjectsPHP Data Objects
PHP Data ObjectsWez Furlong
 
PHP Performance Trivia
PHP Performance TriviaPHP Performance Trivia
PHP Performance TriviaNikita Popov
 
Backbone.js — Introduction to client-side JavaScript MVC
Backbone.js — Introduction to client-side JavaScript MVCBackbone.js — Introduction to client-side JavaScript MVC
Backbone.js — Introduction to client-side JavaScript MVCpootsbook
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkBo-Yi Wu
 
Rails 3: Dashing to the Finish
Rails 3: Dashing to the FinishRails 3: Dashing to the Finish
Rails 3: Dashing to the FinishYehuda Katz
 
PHP and Rich Internet Applications
PHP and Rich Internet ApplicationsPHP and Rich Internet Applications
PHP and Rich Internet Applicationselliando dias
 

Similar to Talkaboutlithium (20)

Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryRemedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
 
Play vs Rails
Play vs RailsPlay vs Rails
Play vs Rails
 
Ch ch-changes cake php2
Ch ch-changes cake php2Ch ch-changes cake php2
Ch ch-changes cake php2
 
Facebook的缓存系统
Facebook的缓存系统Facebook的缓存系统
Facebook的缓存系统
 
Intro to PSGI and Plack
Intro to PSGI and PlackIntro to PSGI and Plack
Intro to PSGI and Plack
 
PHP and Rich Internet Applications
PHP and Rich Internet ApplicationsPHP and Rich Internet Applications
PHP and Rich Internet Applications
 
Bootstrat REST APIs with Laravel 5
Bootstrat REST APIs with Laravel 5Bootstrat REST APIs with Laravel 5
Bootstrat REST APIs with Laravel 5
 
Psgi Plack Sfpm
Psgi Plack SfpmPsgi Plack Sfpm
Psgi Plack Sfpm
 
Psgi Plack Sfpm
Psgi Plack SfpmPsgi Plack Sfpm
Psgi Plack Sfpm
 
Debugging: Rules And Tools - PHPTek 11 Version
Debugging: Rules And Tools - PHPTek 11 VersionDebugging: Rules And Tools - PHPTek 11 Version
Debugging: Rules And Tools - PHPTek 11 Version
 
Rails 3 overview
Rails 3 overviewRails 3 overview
Rails 3 overview
 
Blog Hacks 2011
Blog Hacks 2011Blog Hacks 2011
Blog Hacks 2011
 
Debugging: Rules & Tools
Debugging: Rules & ToolsDebugging: Rules & Tools
Debugging: Rules & Tools
 
How to replace rails asset pipeline with webpack?
How to replace rails asset pipeline with webpack?How to replace rails asset pipeline with webpack?
How to replace rails asset pipeline with webpack?
 
PHP Data Objects
PHP Data ObjectsPHP Data Objects
PHP Data Objects
 
PHP Performance Trivia
PHP Performance TriviaPHP Performance Trivia
PHP Performance Trivia
 
Backbone.js — Introduction to client-side JavaScript MVC
Backbone.js — Introduction to client-side JavaScript MVCBackbone.js — Introduction to client-side JavaScript MVC
Backbone.js — Introduction to client-side JavaScript MVC
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC Framework
 
Rails 3: Dashing to the Finish
Rails 3: Dashing to the FinishRails 3: Dashing to the Finish
Rails 3: Dashing to the Finish
 
PHP and Rich Internet Applications
PHP and Rich Internet ApplicationsPHP and Rich Internet Applications
PHP and Rich Internet Applications
 

Recently uploaded

Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 

Recently uploaded (20)

Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 

Talkaboutlithium

  • 1. talk about lithium cakephper lithium 2012/01/06
  • 4. cakephp Nate Abele cake phpFW cakephp3.0 cakephp php5.3 ( static call ) mongoDB CouchDB 0.10 6
  • 5. 2 git clone li3 (cake bake) http://sourceforge.net/projects/li3/files/ lithium webroot
  • 9.
  • 10. resouce (log templates ) DB (cake routes) DB ( ) mysql mongoDB CouchDB sqlite3 ( ) Apc File Memcache Memory Redis XCache DB DB MongoDB APC (*apc ) mongo Mac : http://d.hatena.ne.jp/yohxx/20110130/1296396115 Cent OS : http://blog.mamemomonga.com/item/460
  • 11. POST
  • 12. database configuration app/lithium/bootstrap/connections.php //mongoDB setting Connections::add(‘dev_mongo’ , array( ‘type’ => ‘MongoDb’ , ‘host’ => ‘localhost’ , ‘database’ => ‘posts’ )); cake
  • 13. model app/models/Post.php <?php namespace appmodels; class Post extends lithiumdataModel {} lithium model
  • 14. controller app/controllers/PostsController.php namespace appcontrollers; ← (java package ) use appmodelsPost; ← (java import ) class PostsController extends lithiumactionController { ← public function index() { ! $posts = Post::all(); ←MongoDB post ! return compact('posts'); } public function add() { ! $success = false; ! if ($this->request->data) { ! $post = Post::create($this->request->data); ! $success = $post->save(); ! } ! return compact('success'); } }
  • 15. view app/views/posts/index.html.php ( ) <?php foreach($posts as $post): ?> <article> <h1><?=$post->title ?></h1> <p><?=$post->body ?></p> </article> <?php endforeach; ?> <?=$this->html->link('add','/posts/add'); ?> app/views/posts/post.html.php <?php if ($success): ?> <p>Post Successfully Saved</p> <?php endif; ?> <?=$this->form->create(); ?> <?=$this->form->field('title');?> <?=$this->form->field('body', array('type' => 'textarea'));?> <?=$this->form->submit('Add Post'); ?> <?=$this->form->end(); ?> <?=$this->html->link('index','/posts/index'); ?> twig smarty cake cake
  • 16. MVC (http://localhost/posts/index)
  • 17. POST! $post = Post::create($this->request->data); lithiumdataentityDocument $post->save(); (json mongo ) mongo
  • 18. mongo
  • 20. cake php controller render ( ) Component DB view .ctp .html.php Cool (cake ww) cake
  • 22.
  • 23. lithium Chain of Respnsibility lithium lithium Chain of Respnsibility J2EE SERVLET Filter (wiki) http://ja.wikipedia.org/wiki/Chain_of_Responsibility_%E3%83%91%E3%82%BF%E3%83%BC%E3%83%B3
  • 24. Filter lithiumactionDispatcher::applyFilter() app/webroot/index.php <?php //log lithiumanalysisLogger::config(array('default' => array('adapter' => 'File'))); $debugMessage = __FUNCTION__ . __LINE__; lithiumactionDispatcher::applyFilter('run', ! function($self, $params, $chain) use ($debugMessage) { ! ! lithiumanalysisLogger::debug($debugMessage); // ! ! $res = $chain->next($self, $params, $chain); // ! ! return $res; ! } ); echo lithiumactionDispatcher::run(new lithiumactionRequest()); (lithiumcoreStaticObject::$_methodFilters key Dispatcher::run ) lithium http://www.1x1.jp/blog/2010/10/lithium_filter_system.html
  • 25. cake controller
  • 26. render lithiumactionController.php protected $_render = array( ! ! 'type' => null, ! ! 'data' => array(), ! ! 'auto' => true, ! ! 'layout' => 'default', ! ! 'template' => null, ! ! 'hasRendered' => false, ! ! 'negotiate' => false ! ); cake $this->layout $this->autoRender lithiumactionController->render()
  • 27. $this->autoRender = false; $this->layout = ‘default’; $this->set(‘key’,‘val’); lithium $this->render(array(‘auto’ => false, ‘layout’ => ‘default’, ‘data’ => compact(‘hogehoge’)));
  • 28. cakephp beforeFiter() _init() uses helpers components log $this->log lithiumanalysisLogger::debug() * cake AppController.php AppController.php $this->log()
  • 29. cake model
  • 30. controller cakephp $this->primaryKey = “hogehoge”; $this->useDbConfig = “sample”; lithium $this->config(‘key’ => ‘hogehoge’, ‘connection’ => ‘sample’); $_meta config() *primarykey id
  • 31. mysql app/config/bootstrap/connections.php Connections::add(“dev_mysql_master” , array( ‘type‘ => ‘database’ , ‘adapter‘ => ‘Mysql’ , ‘host‘ => ‘localhost’ , ‘login‘ => ‘user’ , ‘password’ => ‘pass’ , ’database’ => ‘sampledb’ )); app/models/hogehoge.php $this->config(‘key’ => ‘hogehoge’, ‘connection’ => ‘dev_mysql_maseter’); ← Mysql public static function getAll(){ function args(){ $fields = array(‘id’, ‘title’); $condtions = array(‘id’ => 10); $offset = 3; $order = array(‘created’ => ‘desc’); return compact('fields', 'conditions', 'limit', 'offset', 'order') }; return lithiumdataModel::find('all', $args())->to('array'); }
  • 32. cakephp beforeFiter() _init() model static Mysql PEAR mysql (PDO mysqli ) $this->query() $db = Connections::get($self::meta('connection')); // $db->read('SELECT * FROM post', array('return' => 'array'));  
  • 33. model AppModel.php AppModel.php _init() mysql mongo
  • 34.
  • 35. cake php5.3 mongo couchDB staticObject

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n