SlideShare una empresa de Scribd logo
1 de 45
@wadearnold
      wadearnold.com
wade.arnold@t8webware.com
me?
• PHP developer who became a flash’er MX
• Wrote majority of Zend Amf & lots of
  AMFPHP
• Flash Builder 4 PHP data services
• Currently
 • Scala: Akka STM
 • Thrift: PHP
 • Hadoop: HBase, HDFS, Hive
Every solution I've ever seen or developed in PHP feels
clunky and bulky, there is no elegance or grace. Working
with PHP is a bit like throwing a 10 pound concrete cube
from a ten story building: You'll get where you're going
fast, but it's not very elegant. ... I love PHP, and it's the right
tool for some jobs. It's just an ugly, cumbersome tool that
makes me cry and have nightmares. It's the new VB6 in a C
dress.
Fredrik Holmstrm
Digg, Wikipedia, Facebook, Stumble Upon, Flicker, Tagged,
Vimeo, iStockPhoto, FeedBurner, TechCrunch,YouTube*

                     Written in PHP

               Wordpress, Drupal, Joomla

                     Written in PHP
Some of the largest sites on the internet -- sites you
probably interact with on a daily basis -- are written in
PHP. If PHP sucks so profoundly, why is it powering so
much of the internet?
The only conclusion I can draw is that building a
compelling application is far more important
than choice of language. While PHP wouldn't be my
choice, and if pressed, I might argue that it should never be
the choice for any rational human being sitting in front of a
computer, I can't argue with the results.

                                               Jeff Atwood
                                             Coding Horror
sudo apt-get install zend-framework
Why ZF?
•   Use-at-will Framework

•   Coding Standards / Testing Standards

•   BSD License (Enterprise Friendly)

•   Well Documented

•   Large Community

•   Plenty to integrate!
Why us Zend_Amf?

•   It handles the conversion of data types between
    ActionScript and PHP

•   Converts complex objects and supports class
    mapping

•   Access Control, Authentication, ORM, Logging,
    PHP controllers, another SOA endpoint.
Zend_Amf works?


•   It’s a basic RPC model

    •   SOAP, XML-RPC, REST, etc

•   Call & Response
1 1/2 year’s.....
• Zend Amf Beta was released Oct ‘08
• 226 bugs fixed w/ test cases
• 8 Features added
• 84 outstanding features / bugs
• 89% code coverage 100% method
• 14 SVN committers
• 3 Major refactors
Omar Gonzalez @s9tpepper
Files: Root

app/

lib/

log/

pub/

tmp/
Files: lib/

Zend/
  Acl.php
  ACL/
  Auth/
  Amf/
  ....etc.....
Files: pub/
css/
img/
js/
swf/
  main.swf

xml/
  crossdomain.xml
  gateway-config.xml

.htaccess
index.php
Files: pub/.htaccess
1.RewriteEngine on
2.RewriteEngine ^(crossdomain.xml)$ pub/xml/crossdomain.xml
3.RewriteEngine ^(gateway-config.xml)$ pub/xml/gateway-
  config.xml
4.RewriteEngine ^.(js|ico|gif|jpg|png|xml|swf)$ index.php
5. 
6.php_flag magic_quotes_gpc off
7.php_flag register_globals off
8.php_flag display_errors on
9. 
10.php_value session.auto_start 0
Files: pub/index.php
1.require_once './app/models/HelloWorld.php';
2./** Bootstrap */
3. 
4.// Instantiate server
5.$server = new Zend_Amf_Server();
6.$server->setProduction(false);
7.Zend_Session::start();
8.$server->setSession();
9. 
10.$server->addDirectory(dirname(__FILE__) .'/app/models/');
11. 
12.// Add class to be reflected
13.$server->setClass('HelloWorld');
14.$server->setClass('contact.ContactDAO');
15.$server->setClass('contact.events.ContactDispatch');
16.$server->setClassMap('ContactVo',"Contact");
17. 
18.// Handle request
19.$request = $server->handle();
20.echo($request);
Hybrid site
1.<?php
2.class GatewayController extends Zend_Controller_Action
3.{
4.   public function indexAction()
5.   {
6.      $this->getHelper('ViewRenderer')->setNoRender();      
7.      $server = new Zend_Amf_Server();
8.      $server->addDirectory( dirname(__FILE__) . '/../
  services/' );
9.      echo($server->handle());  
10.   }
11.}
Model


package com.t8.census.vo               <?php
{                                      class Person
	 [Bindable]                           {
	 [RemoteClass(alias="Person")]          public $id = 0;
	 public class PersonVO                  public $age = "";
	 {                                      public $classofworker = "";
	 	 public var id:int = 0;               public $education = "";
	 	 public var age:int;                  public $maritalstatus = "";
	 	 public var classofworker:String;     public $race = "";
	 	 public var education:String;         public $sex = "";
	 	 public var maritalstatus:String;   }
	 	 public var race:String;
	 	 public var sex:String;
	 }
}
SQL



1.CREATE TABLE `census` (
2.  `age` varchar(3) DEFAULT NULL,
3.  `classofworker` varchar(255) DEFAULT NULL,
4.  `education` varchar(255) DEFAULT NULL,
5.  `maritalstatus` varchar(255) DEFAULT NULL,
6.  `race` varchar(255) DEFAULT NULL,
7.  `sex` varchar(255) DEFAULT NULL,
8.  `id` int(11) NOT NULL AUTO_INCREMENT,
9.  PRIMARY KEY (`id`)
10.) ENGINE=InnoDB DEFAULT CHARSET=utf-8
Zend_Db_Table_Abstract


1.class Model_DbTable_Census extends Zend_Db_Table_Abstract
2.{
3.    protected $_rowClass = 'Model_Census';
4.    protected $_name = 'census';
5.}



1.class Model_DbTable_Census extends Zend_Db_Table_Abstract
2.{
3.    protected $_rowClass = 'Model_Census';
4.    protected $_name = 'census';
5.}
Active Record

1.class CensusService {
2.    public function getAllCensus() {
3.        $tbl = new Model_DbTable_Census();
4.        return $tbl->fetchAll()->toArray();
5.    }
6. 
7.    public function getCensusByID( $itemID ) {    
8.        $tbl = new Model_DbTable_Census();
9.        return $tbl->find($itemID)->current();
10.    }
11. 
12.    public function createCensus( $item ) {
13.        $tbl = new Model_DbTable_Census();
14.        $row = $tbl->fetchNew();
15.        $row->setFromArray((array)$item);
16.        $row->save();
17.        return $row->id;
18.    }
19.}
Object-relational mapping




Working with Doctrine, Zend Framework, and Flex
                                           Mihai Corlan
DB Resource Plugin
• Mysqli Result
• Mysql Result
public function getArrayCollection() {
   $this -> connect();
   $sql = "SELECT * FROM census " .
   	 "LIMIT 100";
   $result = mysql_query( $sql ) or die( "Query failed: " .
   mysql_error() );
   return $result;
}
DUDE IT’s PHP
1.  public function getAllItems()  {
2.     $this -> connect();
3.     $sql = "SELECT * FROM census";
4.     $result = mysql_query( $sql ) or die( "Query failed: " .
5.       mysql_error() );
6.  
7.     $census = array();
8.  
9.     while( $row = mysql_fetch_assoc( $result ) ) {
10.      $person = new Person();
11.      $person -> id = $row["id"];
12.      $person -> age = $row["age"];
13.      $person -> classofworker = $row["classofworker"];
14.      $person -> education = $row["education"];
15.      $person -> maritalstatus = $row["maritalstatus"];  
16.      $person -> race = $row["race"];
17.      $person -> sex = $row["sex"];  
18.     
19.      array_push( $census, $person );
20.    }
21.    return $census;
22.  }
Simple Rest
spl_autoload_register(); // don't load our classes unless we use
them

$mode = 'debug'; // 'debug' or 'production'
$server = new RestServer($mode);
// $server->refreshCache(); // uncomment momentarily to clear
the cache if classes change in production mode
$server->addClass('TestController');
$server->addClass('ProductsController', '/products'); // adds
this as a base to all the URLs in this class
$server->handle();
Authentication
public function ServiceDelegateAmf(responder:IResponder):void {
	 this.responder = responder;
	 this.service =
ServiceLocator.getInstance().getRemoteObject("zendamf");
	 this.service.setCredentials("wade", "arnold");
}
Create Auth Adapter
class RemoteUser extends Zend_Amf_Auth_Abstract
{
    public function __construct($name, $role)
    {
        $this->_name = $name;
        $this->_role = $role;
    }
    public function authenticate()
    {
        $id = new stdClass();
        $id->role = $this->_role;
        $id->name = $this->_name;
        return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS,
$id);
    }
}
bootstrap

$this->_server = new Zend_Amf_Server();

$this->_acl = new Zend_Acl();
$this->_server->setAuth(new RemoteUser("wade", "testrole"));
$this->_acl->addRole(new Zend_Acl_Role("testrole"));
$this->_acl->allow("testrole", null, null);
$this->_server->setAcl($this->_acl);
Basic Service
class demo {
    function hello() {
        return "hello!";
    }

    function hello2() {
        return "hello2!";
    }

    function initAcl(Zend_Acl $acl) {
        $acl->allow("testrole", null, "hello");
        $acl->allow("testrole2", null, "hello2");
        return true;
    }
}
More Auth & ACL!

• Open ID
• Ldap
• Database
• Conditional rules
• OAuth
What’s Next?
• Better Class Loader, AMF0 complete
• Documentation
 • Adobe Evangalist, Adobe TV, DZone
• HTTP Long Pulling
• Speed
 • cache reflection
 • AMFEXT
Help?


 Issue tracker
   Mailing list
Documentation
twitter.com/wadearnold
      wadearnold.com
wade.arnold@t8webware.com

Más contenido relacionado

La actualidad más candente

The IoC Hydra - Dutch PHP Conference 2016
The IoC Hydra - Dutch PHP Conference 2016The IoC Hydra - Dutch PHP Conference 2016
The IoC Hydra - Dutch PHP Conference 2016Kacper Gunia
 
Forget about Index.php and build you applications around HTTP - PHPers Cracow
Forget about Index.php and build you applications around HTTP - PHPers CracowForget about Index.php and build you applications around HTTP - PHPers Cracow
Forget about Index.php and build you applications around HTTP - PHPers CracowKacper Gunia
 
Introducing Assetic (NYPHP)
Introducing Assetic (NYPHP)Introducing Assetic (NYPHP)
Introducing Assetic (NYPHP)Kris Wallsmith
 
Redis for your boss 2.0
Redis for your boss 2.0Redis for your boss 2.0
Redis for your boss 2.0Elena Kolevska
 
Min-Maxing Software Costs - Laracon EU 2015
Min-Maxing Software Costs - Laracon EU 2015Min-Maxing Software Costs - Laracon EU 2015
Min-Maxing Software Costs - Laracon EU 2015Konstantin Kudryashov
 
Intro to php
Intro to phpIntro to php
Intro to phpSp Singh
 
Doctrine MongoDB ODM (PDXPHP)
Doctrine MongoDB ODM (PDXPHP)Doctrine MongoDB ODM (PDXPHP)
Doctrine MongoDB ODM (PDXPHP)Kris Wallsmith
 
Decoupling with Design Patterns and Symfony2 DIC
Decoupling with Design Patterns and Symfony2 DICDecoupling with Design Patterns and Symfony2 DIC
Decoupling with Design Patterns and Symfony2 DICKonstantin Kudryashov
 
Forget about index.php and build you applications around HTTP!
Forget about index.php and build you applications around HTTP!Forget about index.php and build you applications around HTTP!
Forget about index.php and build you applications around HTTP!Kacper Gunia
 
PHPCon 2016: PHP7 by Witek Adamus / XSolve
PHPCon 2016: PHP7 by Witek Adamus / XSolvePHPCon 2016: PHP7 by Witek Adamus / XSolve
PHPCon 2016: PHP7 by Witek Adamus / XSolveXSolve
 
Corephpcomponentpresentation 1211425966721657-8
Corephpcomponentpresentation 1211425966721657-8Corephpcomponentpresentation 1211425966721657-8
Corephpcomponentpresentation 1211425966721657-8PrinceGuru MS
 
You code sucks, let's fix it
You code sucks, let's fix itYou code sucks, let's fix it
You code sucks, let's fix itRafael Dohms
 
Models and Service Layers, Hemoglobin and Hobgoblins
Models and Service Layers, Hemoglobin and HobgoblinsModels and Service Layers, Hemoglobin and Hobgoblins
Models and Service Layers, Hemoglobin and HobgoblinsRoss Tuck
 

La actualidad más candente (20)

The IoC Hydra - Dutch PHP Conference 2016
The IoC Hydra - Dutch PHP Conference 2016The IoC Hydra - Dutch PHP Conference 2016
The IoC Hydra - Dutch PHP Conference 2016
 
Php security3895
Php security3895Php security3895
Php security3895
 
Forget about Index.php and build you applications around HTTP - PHPers Cracow
Forget about Index.php and build you applications around HTTP - PHPers CracowForget about Index.php and build you applications around HTTP - PHPers Cracow
Forget about Index.php and build you applications around HTTP - PHPers Cracow
 
Redis for your boss
Redis for your bossRedis for your boss
Redis for your boss
 
Introducing Assetic (NYPHP)
Introducing Assetic (NYPHP)Introducing Assetic (NYPHP)
Introducing Assetic (NYPHP)
 
Redis for your boss 2.0
Redis for your boss 2.0Redis for your boss 2.0
Redis for your boss 2.0
 
Intro to PHP
Intro to PHPIntro to PHP
Intro to PHP
 
Min-Maxing Software Costs - Laracon EU 2015
Min-Maxing Software Costs - Laracon EU 2015Min-Maxing Software Costs - Laracon EU 2015
Min-Maxing Software Costs - Laracon EU 2015
 
Intro to php
Intro to phpIntro to php
Intro to php
 
Doctrine MongoDB ODM (PDXPHP)
Doctrine MongoDB ODM (PDXPHP)Doctrine MongoDB ODM (PDXPHP)
Doctrine MongoDB ODM (PDXPHP)
 
Decoupling with Design Patterns and Symfony2 DIC
Decoupling with Design Patterns and Symfony2 DICDecoupling with Design Patterns and Symfony2 DIC
Decoupling with Design Patterns and Symfony2 DIC
 
Min-Maxing Software Costs
Min-Maxing Software CostsMin-Maxing Software Costs
Min-Maxing Software Costs
 
Forget about index.php and build you applications around HTTP!
Forget about index.php and build you applications around HTTP!Forget about index.php and build you applications around HTTP!
Forget about index.php and build you applications around HTTP!
 
PHPCon 2016: PHP7 by Witek Adamus / XSolve
PHPCon 2016: PHP7 by Witek Adamus / XSolvePHPCon 2016: PHP7 by Witek Adamus / XSolve
PHPCon 2016: PHP7 by Witek Adamus / XSolve
 
CodeIgniter 3.0
CodeIgniter 3.0CodeIgniter 3.0
CodeIgniter 3.0
 
The IoC Hydra
The IoC HydraThe IoC Hydra
The IoC Hydra
 
Corephpcomponentpresentation 1211425966721657-8
Corephpcomponentpresentation 1211425966721657-8Corephpcomponentpresentation 1211425966721657-8
Corephpcomponentpresentation 1211425966721657-8
 
You code sucks, let's fix it
You code sucks, let's fix itYou code sucks, let's fix it
You code sucks, let's fix it
 
Lithium Best
Lithium Best Lithium Best
Lithium Best
 
Models and Service Layers, Hemoglobin and Hobgoblins
Models and Service Layers, Hemoglobin and HobgoblinsModels and Service Layers, Hemoglobin and Hobgoblins
Models and Service Layers, Hemoglobin and Hobgoblins
 

Similar a Fatc

Building Testable PHP Applications
Building Testable PHP ApplicationsBuilding Testable PHP Applications
Building Testable PHP Applicationschartjes
 
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐいHisateru Tanaka
 
PHP and Rich Internet Applications
PHP and Rich Internet ApplicationsPHP and Rich Internet Applications
PHP and Rich Internet Applicationselliando dias
 
Zend Framework Study@Tokyo #2
Zend Framework Study@Tokyo #2Zend Framework Study@Tokyo #2
Zend Framework Study@Tokyo #2Shinya Ohyanagi
 
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...King Foo
 
Becoming a better WordPress Developer
Becoming a better WordPress DeveloperBecoming a better WordPress Developer
Becoming a better WordPress DeveloperJoey Kudish
 
[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVCAlive Kuo
 
Unit testing with zend framework PHPBenelux
Unit testing with zend framework PHPBeneluxUnit testing with zend framework PHPBenelux
Unit testing with zend framework PHPBeneluxMichelangelo van Dam
 
Quality assurance for php projects with PHPStorm
Quality assurance for php projects with PHPStormQuality assurance for php projects with PHPStorm
Quality assurance for php projects with PHPStormMichelangelo van Dam
 
Unit testing with zend framework tek11
Unit testing with zend framework tek11Unit testing with zend framework tek11
Unit testing with zend framework tek11Michelangelo van Dam
 
Charla EHU Noviembre 2014 - Desarrollo Web
Charla EHU Noviembre 2014 - Desarrollo WebCharla EHU Noviembre 2014 - Desarrollo Web
Charla EHU Noviembre 2014 - Desarrollo WebMikel Torres Ugarte
 
Doctrine For Beginners
Doctrine For BeginnersDoctrine For Beginners
Doctrine For BeginnersJonathan Wage
 
Zend Framework 1.9 Setup & Using Zend_Tool
Zend Framework 1.9 Setup & Using Zend_ToolZend Framework 1.9 Setup & Using Zend_Tool
Zend Framework 1.9 Setup & Using Zend_ToolGordon Forsythe
 
[Bristol WordPress] Supercharging WordPress Development
[Bristol WordPress] Supercharging WordPress Development[Bristol WordPress] Supercharging WordPress Development
[Bristol WordPress] Supercharging WordPress DevelopmentAdam Tomat
 
Dmp hadoop getting_start
Dmp hadoop getting_startDmp hadoop getting_start
Dmp hadoop getting_startGim GyungJin
 
Bootstrat REST APIs with Laravel 5
Bootstrat REST APIs with Laravel 5Bootstrat REST APIs with Laravel 5
Bootstrat REST APIs with Laravel 5Elena Kolevska
 
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)arcware
 

Similar a Fatc (20)

Zendcon 09
Zendcon 09Zendcon 09
Zendcon 09
 
Building Testable PHP Applications
Building Testable PHP ApplicationsBuilding Testable PHP Applications
Building Testable PHP Applications
 
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい
 
PHP and Rich Internet Applications
PHP and Rich Internet ApplicationsPHP and Rich Internet Applications
PHP and Rich Internet Applications
 
Zend Framework Study@Tokyo #2
Zend Framework Study@Tokyo #2Zend Framework Study@Tokyo #2
Zend Framework Study@Tokyo #2
 
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
 
Becoming a better WordPress Developer
Becoming a better WordPress DeveloperBecoming a better WordPress Developer
Becoming a better WordPress Developer
 
[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC
 
Unit testing with zend framework PHPBenelux
Unit testing with zend framework PHPBeneluxUnit testing with zend framework PHPBenelux
Unit testing with zend framework PHPBenelux
 
Quality assurance for php projects with PHPStorm
Quality assurance for php projects with PHPStormQuality assurance for php projects with PHPStorm
Quality assurance for php projects with PHPStorm
 
Building Custom PHP Extensions
Building Custom PHP ExtensionsBuilding Custom PHP Extensions
Building Custom PHP Extensions
 
Unit testing with zend framework tek11
Unit testing with zend framework tek11Unit testing with zend framework tek11
Unit testing with zend framework tek11
 
Charla EHU Noviembre 2014 - Desarrollo Web
Charla EHU Noviembre 2014 - Desarrollo WebCharla EHU Noviembre 2014 - Desarrollo Web
Charla EHU Noviembre 2014 - Desarrollo Web
 
Doctrine For Beginners
Doctrine For BeginnersDoctrine For Beginners
Doctrine For Beginners
 
Zend Framework 1.9 Setup & Using Zend_Tool
Zend Framework 1.9 Setup & Using Zend_ToolZend Framework 1.9 Setup & Using Zend_Tool
Zend Framework 1.9 Setup & Using Zend_Tool
 
Unit testing zend framework apps
Unit testing zend framework appsUnit testing zend framework apps
Unit testing zend framework apps
 
[Bristol WordPress] Supercharging WordPress Development
[Bristol WordPress] Supercharging WordPress Development[Bristol WordPress] Supercharging WordPress Development
[Bristol WordPress] Supercharging WordPress Development
 
Dmp hadoop getting_start
Dmp hadoop getting_startDmp hadoop getting_start
Dmp hadoop getting_start
 
Bootstrat REST APIs with Laravel 5
Bootstrat REST APIs with Laravel 5Bootstrat REST APIs with Laravel 5
Bootstrat REST APIs with Laravel 5
 
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
 

Último

How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
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
 

Último (20)

How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
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
 

Fatc

  • 1. @wadearnold wadearnold.com wade.arnold@t8webware.com
  • 2. me? • PHP developer who became a flash’er MX • Wrote majority of Zend Amf & lots of AMFPHP • Flash Builder 4 PHP data services • Currently • Scala: Akka STM • Thrift: PHP • Hadoop: HBase, HDFS, Hive
  • 3. Every solution I've ever seen or developed in PHP feels clunky and bulky, there is no elegance or grace. Working with PHP is a bit like throwing a 10 pound concrete cube from a ten story building: You'll get where you're going fast, but it's not very elegant. ... I love PHP, and it's the right tool for some jobs. It's just an ugly, cumbersome tool that makes me cry and have nightmares. It's the new VB6 in a C dress. Fredrik Holmstrm
  • 4.
  • 5. Digg, Wikipedia, Facebook, Stumble Upon, Flicker, Tagged, Vimeo, iStockPhoto, FeedBurner, TechCrunch,YouTube* Written in PHP Wordpress, Drupal, Joomla Written in PHP
  • 6. Some of the largest sites on the internet -- sites you probably interact with on a daily basis -- are written in PHP. If PHP sucks so profoundly, why is it powering so much of the internet? The only conclusion I can draw is that building a compelling application is far more important than choice of language. While PHP wouldn't be my choice, and if pressed, I might argue that it should never be the choice for any rational human being sitting in front of a computer, I can't argue with the results. Jeff Atwood Coding Horror
  • 7.
  • 8.
  • 9.
  • 10. sudo apt-get install zend-framework
  • 11.
  • 12.
  • 13. Why ZF? • Use-at-will Framework • Coding Standards / Testing Standards • BSD License (Enterprise Friendly) • Well Documented • Large Community • Plenty to integrate!
  • 14. Why us Zend_Amf? • It handles the conversion of data types between ActionScript and PHP • Converts complex objects and supports class mapping • Access Control, Authentication, ORM, Logging, PHP controllers, another SOA endpoint.
  • 15. Zend_Amf works? • It’s a basic RPC model • SOAP, XML-RPC, REST, etc • Call & Response
  • 16. 1 1/2 year’s..... • Zend Amf Beta was released Oct ‘08 • 226 bugs fixed w/ test cases • 8 Features added • 84 outstanding features / bugs • 89% code coverage 100% method • 14 SVN committers • 3 Major refactors
  • 18.
  • 20. Files: lib/ Zend/ Acl.php ACL/ Auth/ Amf/ ....etc.....
  • 21. Files: pub/ css/ img/ js/ swf/ main.swf xml/ crossdomain.xml gateway-config.xml .htaccess index.php
  • 22. Files: pub/.htaccess 1.RewriteEngine on 2.RewriteEngine ^(crossdomain.xml)$ pub/xml/crossdomain.xml 3.RewriteEngine ^(gateway-config.xml)$ pub/xml/gateway- config.xml 4.RewriteEngine ^.(js|ico|gif|jpg|png|xml|swf)$ index.php 5.  6.php_flag magic_quotes_gpc off 7.php_flag register_globals off 8.php_flag display_errors on 9.  10.php_value session.auto_start 0
  • 23. Files: pub/index.php 1.require_once './app/models/HelloWorld.php'; 2./** Bootstrap */ 3.  4.// Instantiate server 5.$server = new Zend_Amf_Server(); 6.$server->setProduction(false); 7.Zend_Session::start(); 8.$server->setSession(); 9.  10.$server->addDirectory(dirname(__FILE__) .'/app/models/'); 11.  12.// Add class to be reflected 13.$server->setClass('HelloWorld'); 14.$server->setClass('contact.ContactDAO'); 15.$server->setClass('contact.events.ContactDispatch'); 16.$server->setClassMap('ContactVo',"Contact"); 17.  18.// Handle request 19.$request = $server->handle(); 20.echo($request);
  • 24. Hybrid site 1.<?php 2.class GatewayController extends Zend_Controller_Action 3.{ 4.   public function indexAction() 5.   { 6.      $this->getHelper('ViewRenderer')->setNoRender();       7.      $server = new Zend_Amf_Server(); 8.      $server->addDirectory( dirname(__FILE__) . '/../ services/' ); 9.      echo($server->handle());   10.   } 11.}
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30. Model package com.t8.census.vo <?php { class Person [Bindable] { [RemoteClass(alias="Person")] public $id = 0; public class PersonVO public $age = ""; { public $classofworker = ""; public var id:int = 0; public $education = ""; public var age:int; public $maritalstatus = ""; public var classofworker:String; public $race = ""; public var education:String; public $sex = ""; public var maritalstatus:String; } public var race:String; public var sex:String; } }
  • 31. SQL 1.CREATE TABLE `census` ( 2.  `age` varchar(3) DEFAULT NULL, 3.  `classofworker` varchar(255) DEFAULT NULL, 4.  `education` varchar(255) DEFAULT NULL, 5.  `maritalstatus` varchar(255) DEFAULT NULL, 6.  `race` varchar(255) DEFAULT NULL, 7.  `sex` varchar(255) DEFAULT NULL, 8.  `id` int(11) NOT NULL AUTO_INCREMENT, 9.  PRIMARY KEY (`id`) 10.) ENGINE=InnoDB DEFAULT CHARSET=utf-8
  • 32. Zend_Db_Table_Abstract 1.class Model_DbTable_Census extends Zend_Db_Table_Abstract 2.{ 3.    protected $_rowClass = 'Model_Census'; 4.    protected $_name = 'census'; 5.} 1.class Model_DbTable_Census extends Zend_Db_Table_Abstract 2.{ 3.    protected $_rowClass = 'Model_Census'; 4.    protected $_name = 'census'; 5.}
  • 33. Active Record 1.class CensusService { 2.    public function getAllCensus() { 3.        $tbl = new Model_DbTable_Census(); 4.        return $tbl->fetchAll()->toArray(); 5.    } 6.  7.    public function getCensusByID( $itemID ) {     8.        $tbl = new Model_DbTable_Census(); 9.        return $tbl->find($itemID)->current(); 10.    } 11.  12.    public function createCensus( $item ) { 13.        $tbl = new Model_DbTable_Census(); 14.        $row = $tbl->fetchNew(); 15.        $row->setFromArray((array)$item); 16.        $row->save(); 17.        return $row->id; 18.    } 19.}
  • 34. Object-relational mapping Working with Doctrine, Zend Framework, and Flex Mihai Corlan
  • 35. DB Resource Plugin • Mysqli Result • Mysql Result public function getArrayCollection() { $this -> connect(); $sql = "SELECT * FROM census " . "LIMIT 100"; $result = mysql_query( $sql ) or die( "Query failed: " . mysql_error() ); return $result; }
  • 36. DUDE IT’s PHP 1.  public function getAllItems()  { 2.     $this -> connect(); 3.     $sql = "SELECT * FROM census"; 4.     $result = mysql_query( $sql ) or die( "Query failed: " . 5.       mysql_error() ); 6.   7.     $census = array(); 8.   9.     while( $row = mysql_fetch_assoc( $result ) ) { 10.      $person = new Person(); 11.      $person -> id = $row["id"]; 12.      $person -> age = $row["age"]; 13.      $person -> classofworker = $row["classofworker"]; 14.      $person -> education = $row["education"]; 15.      $person -> maritalstatus = $row["maritalstatus"];   16.      $person -> race = $row["race"]; 17.      $person -> sex = $row["sex"];   18.      19.      array_push( $census, $person ); 20.    } 21.    return $census; 22.  }
  • 37. Simple Rest spl_autoload_register(); // don't load our classes unless we use them $mode = 'debug'; // 'debug' or 'production' $server = new RestServer($mode); // $server->refreshCache(); // uncomment momentarily to clear the cache if classes change in production mode $server->addClass('TestController'); $server->addClass('ProductsController', '/products'); // adds this as a base to all the URLs in this class $server->handle();
  • 38. Authentication public function ServiceDelegateAmf(responder:IResponder):void { this.responder = responder; this.service = ServiceLocator.getInstance().getRemoteObject("zendamf"); this.service.setCredentials("wade", "arnold"); }
  • 39. Create Auth Adapter class RemoteUser extends Zend_Amf_Auth_Abstract { public function __construct($name, $role) { $this->_name = $name; $this->_role = $role; } public function authenticate() { $id = new stdClass(); $id->role = $this->_role; $id->name = $this->_name; return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $id); } }
  • 40. bootstrap $this->_server = new Zend_Amf_Server(); $this->_acl = new Zend_Acl(); $this->_server->setAuth(new RemoteUser("wade", "testrole")); $this->_acl->addRole(new Zend_Acl_Role("testrole")); $this->_acl->allow("testrole", null, null); $this->_server->setAcl($this->_acl);
  • 41. Basic Service class demo { function hello() { return "hello!"; } function hello2() { return "hello2!"; } function initAcl(Zend_Acl $acl) { $acl->allow("testrole", null, "hello"); $acl->allow("testrole2", null, "hello2"); return true; } }
  • 42. More Auth & ACL! • Open ID • Ldap • Database • Conditional rules • OAuth
  • 43. What’s Next? • Better Class Loader, AMF0 complete • Documentation • Adobe Evangalist, Adobe TV, DZone • HTTP Long Pulling • Speed • cache reflection • AMFEXT
  • 44. Help? Issue tracker Mailing list Documentation
  • 45. twitter.com/wadearnold wadearnold.com wade.arnold@t8webware.com

Notas del editor