SlideShare uma empresa Scribd logo
1 de 74
Baixar para ler offline
PECL Picks
Extensions to make your life better
Who am I?
•   Elizabeth Marie Smith aka auroraeosrose
•   Pink is good
•   I hate computers
•   I love programming
•   Windows will not kill you
•   Work at OmniTI (http://omniti.com)
•   Contributor on various open source projects
    (including PHP, PECL and PHP-GTK)
No, it’s not a cucumber soaked in brine…
What is PECL?
• PHP Extension Code Library
• The place for PHP extensions
• Benefits:
 ▫   snapshot builds and win32 build support
 ▫   code hosting and distribution
 ▫   pecl install (PEAR packaging and installer support)
 ▫   community
 ▫   advertising
• No GPL code – license should be PHP license
  compatible (LGPL ok)
History
• Split off from PEAR in 2003
• Wez Furlong is “instigator”
 ▫ see famous letter
 ▫ http://news.php.net/article.php?group=php.pecl.
   dev&article=5
• Many of the points raised still need work –
  mainly PECL needs manpower, bodies to do the
  work
Current Status
• Supposed to allow independent release cycles
  ▫ kind of successful
• Has less oversight into code quality
  ▫ pecl qa?
  ▫ needs someone to be “secretary” and “organizer”
  ▫ always need people to test code, write tests, triage
    bugs, write docs
• Still has “siberia” modules
Future Plans and Ideas
• Real Siberia
  ▫ delete badly licensed extensions
  ▫ delete AWOL extensions
  ▫ move dead (superseded, library no longer exists)
• Better Windows Support
  ▫ Release builds
  ▫ CVS snapshot builds
• Recruit Developers and Helpers
  ▫ This talk
  ▫ Marketing – blog posts, podcasts, word of mouth
• Pyrus and PEAR installer fixes
• Automated testing for stuff in CVS
PECL and PHP Core
• Core -> PECL
 ▫   no, not to die
 ▫   few users
 ▫   not as widely useful features
 ▫   lack of maintainers
 ▫   examples: ncurses, dbase
• PECL -> Core
 ▫   widely useful features
 ▫   lots of users
 ▫   good maintenance
 ▫   examples: phar, zip, json
How to join PECL
• Subscribe to the pecl.dev mailing list
  ▫ pecl-dev-subscribe@lists.php.net
• Introduce yourself, if you have a project idea
  introduce it and show some code, meet people,
  ask questions
• #php.pecl IRC channel at the efnet.org
• To learn how to write extensions – go to Sara’s
  talk at 4pm today!
Using PECL
• pecl install {$extname}
  ▫ isn’t always available
  ▫ doesn’t work correctly on windows
  ▫ downloads, configures, compiles for you
• compile by hand
  ▫ always works
  ▫ requires some knowledge
• use binaries
  ▫ windows – download, put in /ext directory, enable in
    php.ini
  ▫ third party packages for pecl (rpm, .deb, whatever)
Let’s pick a peck of pickled PECLs
Types of Extensions
•   Wrap a C Library
•   Provide functionality in C code instead of PHP
•   Alter engine functionality
•   Provide debugging features
•   Allow embedded languages
Why would you want a C extension?
• Functionality
• Speed
• Do the impossible
Picks Criteria
• Popularity is hard to judge, although some try
 ▫ http://www.nexen.net/articles/dossier/18038-
   base_configuration_for_php_5.2.5.php
• Usefulness is hard to judge, people have
  different needs
• What I think you might find useful
• Extensions I think are cool
Opcode Caching
Caches the compiled bytecode of PHP scripts to
 avoid the overhead of parsing and compiling
 source code on each request (some or all of
 which may never even be executed)

For best performance, caching is to shared
 memory with direct execution from the shared
 memory and the minimum of memory copying
 at runtime.
APC - Alternative PHP Cache
• Maintainer:
 ▫   George Schlossnagle
 ▫   Daniel Cowgill
 ▫   Rasmus Lerdorf
 ▫   Gopal Vijayaraghavan
• Type: Engine Changes
• Release: 3.0.19 stable 2008-05-15
• Description: APC is a free, open, and robust
  framework for caching and optimizing PHP
  intermediate code.
Using APC                                       APC is both an
                                                   opcode cache and
                                                   an in memory
 <?php
 $bar = 'BAR';                                     cache to store data
 apc_add('foo', $bar);
 var_dump(apc_fetch('foo'));                       in your scripts
 echo quot;nquot;;
 $bar = 'NEVER GETS SET';
                                                It can also be used for
 apc_add('foo', $bar);                             file progress
 var_dump(apc_fetch('foo'));
 echo quot;nquot;;                                        uploads
 $constants = array(
      'ONE' => 1,
      'TWO' => 2,
      'THREE' => 3,
 );
 apc_define_constants('numbers', $constants);
 echo ONE, TWO, THREE;
 echo quot;nquot;;
 $bar = 'BAR';
 apc_store('foo', $bar);                        string(3) quot;BARquot;
 apc_delete('foo');
 // this is obviously useless in this form      string(3) quot;BARquot;
 $bar = 'BAR';                                  123
 apc_store('foo', $bar);
 var_dump(apc_fetch('foo'));                    string(3) quot;BARquot;
Memcache
• Maintainer:
  ▫ Antony Dovgal
  ▫ Mikael Johansson
• Type: Internal code (doesn’t use C client lib)
• Release: 2.2.3 stable 2008-02-05
            3.0.1 beta 2008-02-05
• Description: Memcached is a caching daemon
  designed especially for dynamic web applications to
  decrease database load by storing objects in
  memory.
  This extension allows you to work with memcached
  through handy OO and procedural interfaces.
Using Memcache                                                http://www.danga.com/me
                                                                 mcached/
 <?php
                                                              For more information
 $memcache = new Memcache;                                      about memcached
 $memcache-
 >connect('localhost', 11211) or die (quot;Could not connectquot;);
 $version = $memcache->getVersion();                             memcached is a high-
 echo quot;Server's version: quot;.$version.quot;<br/>nquot;;                    performance, distributed
 $tmp_object = new stdClass;                                      memory object caching
 $tmp_object->str_attr = 'test';                                  system, generic in
 $tmp_object->int_attr = 123;                                     nature, but intended for
 $memcache-                                                       use in speeding up
 >set('key', $tmp_object, false, 10) or die (quot;Failed to save data dynamic web
 at the serverquot;);
 echo quot;Store data in the cache (data will expire in 10 second applications by
 s)<br/>nquot;;                                                      alleviating database load.
 $get_result = $memcache->get('key');
 echo quot;Data from the cache:<br/>nquot;;
 var_dump($get_result);
Image Manipulation
•   gd (php core)
•   imagick
•   cairo (new, gsoc 2008, not yet released)
•   cairo_wrapper
•   FreeImage (imagemagick library fork)
•   imlib2
Imagick
• Maintainer:
  ▫ Mikko Koppanen
  ▫ Scott MacVicar
• Type: Library Wrapper
• Library: Imagick
  http://www.imagemagick.org/script/index.php
• Release: 2.2.0 stable 2008-07-09
            2.2.1RC2 beta 2008-09-05
• Description: Imagick is a native php extension to create
  and modify images using the ImageMagick API.
  This extension requires ImageMagick version 6.2.4+ and
  PHP 5.1.3+.
Using Imagick
<?php                                                           $canvas->newImage(350, 70, quot;whitequot;);
 Create a new imagick object */
$im = new Imagick();                                            /* Draw the ImagickDraw on to the canvas */
                                                                $canvas->drawImage($draw);
/* Create new image. This will be used as fill pattern */
$im->newPseudoImage(50, 50, quot;gradient:red-blackquot;);              /* 1px black border around the image */
                                                                $canvas->borderImage('black', 1, 1);
/* Create imagickdraw object */
$draw = new ImagickDraw();                                      /* Set the format to PNG */
                                                                $canvas->setImageFormat('png');
/* Start a new pattern called quot;gradientquot; */
$draw->pushPattern('gradient', 0, 0, 50, 50);                   /* Output the image */
                                                                header(quot;Content-Type: image/pngquot;);
/* Composite the gradient on the pattern */                     echo $canvas;
$draw->composite(Imagick::COMPOSITE_OVER, 0, 0, 50, 50, $im);

/* Close the pattern */
$draw->popPattern();

/* Use the pattern called quot;gradientquot; as the fill */
$draw->setFillPatternURL('#gradient');

/* Set font size to 52 */
$draw->setFontSize(52);

/* Annotate some text */
$draw->annotation(20, 50, quot;Hello World!quot;);

/* Create a new canvas object and a white image */
$canvas = new Imagick();
HTTP Related
• uploadprogress
• pecl_http (so named to avoid classes with PEAR
  http)
Http
• Maintainer: Michael Wallner
• Type: Added Functionality
• Release: 1.6.1 stable 2008-07-23

• Description: This extension eases handling of HTTP urls,
  dates, redirects, headers and messages, provides means for
  negotiation of clients preferred language and charset, as well
  as a convenient way to send any arbitrary data with caching
  and resuming capabilities.
  It provides powerful request functionality, if built with CURL
  support. Parallel requests are available for PHP 5 and greater.
Using HTTP
<?php
try {                                                                   $charsets = array(
      $pool = new HttpRequestPool(                                                  'iso-8859-1', // default
            new HttpRequest('http://www.google.com/', HttpRequest::M                'iso-8859-2',
ETH_HEAD),                                                                          'iso-8859-15',
            new HttpRequest('http://www.php.net/', HttpRequest::METH                'utf-8'
_HEAD)                                                                  );
      );
      $pool->send();                                                    $pref = http_negotiate_charset($charsets, $result);
      foreach($pool as $request) {
            printf(quot;%s is %s (%d)nquot;,                                   if (strcmp($pref, 'iso-8859-1')) {
                   $request->getUrl(),                                              iconv_set_encoding('internal_encoding', 'iso-8859-1');
                   $request->getResponseCode() ? 'alive' : 'not alive',             iconv_set_encoding('output_encoding', $pref);
                   $request->getResponseCode()                                      ob_start('ob_iconv_handler');
            );                                                          }
      }
} catch (HttpException $e) {                                            print_r($result);
      echo $e;
}

$string = quot;quot;.
      quot;05rnquot;.
      quot;this rnquot;.
      quot;07rnquot;.
      quot;string rnquot;.
      quot;12rnquot;.
      quot;is chunked encodedrnquot;.
      quot;01nrnquot;.
      quot;00quot;;
echo http_chunked_decode($string);
Upload Progress
• Maintainer: Christian Stocker
             Ben Ramsey
• Type: Added Functionality
• Release: 0.9.1 beta 2008-08-25

• Description: An extension to track progress of a
  file upload.
About UploadProgress
prototypes

string uploadprogress_get_contents(string identifier, string fieldname[, int maxlen])
array uploadprogress_get_info(string identifier)

array returned

Array
{
             [identifier] => string,
             [identifier_tmp] => string,
             [upload_id] => string,
             [data_filename] => temp data file,
             [fieldname] => upload field name,
             [filename] => filename of uploaded file,
             [time_start] => int,
             [time_last] => int,
             [speed_average] => int,
             [speed_last] => int,
             [bytes_uploaded] => int,
             [bytes_total] => int,
             [files_uploaded] => int,
             [est_sec] => int
}

This gives a lot more information then, for example, APC's upload progress implementation
PDF Madness
•   clibpdf (commercial – discontinued)
•   pdflib (commercial)
•   panda (Panda C library)
•   haru (libharu – winner!)
•   ps (postscript – if you need it)
Haru
•   Maintainer: Antony Dovgal
•   Type: C library wrapper
•   Lib: http://libharu.org/
•   Release: 0.0.1 beta 2007-03-26

• Description: PHP interface to Haru Free PDF
  Library for creating PDF documents
Using Haru
<?php
   $doc = new HaruDoc;
   $doc->setPageMode(HaruDoc::PAGE_MODE_USE_THUMBS); /* show thumbnails */
   $page = $doc->addPage(); /* add page to the document */
   $page-
   >setSize(HaruPage::SIZE_A4, HaruPage::LANDSCAPE); /* set the page to use A4 landscape
   format */
   $courier = $doc->getFont(quot;Courier-Boldquot;); /* we'll use the bundled font a few lines below */   From php.net –
   $page->setRGBStroke(0, 0, 0); /* set colors */                                                   should create
   $page->setRGBFill(0.7, 0.8, 0.9);
   $page->rectangle(150, 150, 550, 250); /* draw a rectangle */                                     a pdf with a
   $page->fillStroke(); /* fill and stroke it */                                                    light-blue
   $page->setDash(array(3, 3), 0); /* set dash style for lines at this page */                      rectangle and
   $page->setFontAndSize($courier, 60); /* set font and size */
                                                                                                    white quot;Hello
   $page->setRGBStroke(0.5, 0.5, 0.1); /* set line color */
   $page->setRGBFill(1, 1, 1); /* set filling color */                                              World!quot; on it
   $page->setTextRenderingMode(HaruPage::FILL_THEN_STROKE); /* fill and stroke text */
   /* print the text */
   $page->beginText();
   $page->textOut(210, 270, quot;Hello World!quot;);
   $page->endText();
   $doc->save(quot;/tmp/test.pdfquot;); /* save the document into a file */
Amfext
• Maintainer: Emanuele Ruffaldi
• Type:Added Functionality
• Release: 0.9.2 beta 2008-07-23

• Description: Allows to encode and decode PHP
  data in ActionScript Message Format (AMF)
  version 0 and 3
Using AMFEXT
<?php

$r = amf_encode(quot;hello worldquot;,AMF_AS_STRING_BUILDER); // ask to return a S
B
echo(quot;returned type: quot; . $r . quot;nquot;);
echo(quot;returned length: quot; . amf_sb_length($r) . quot;nquot;);
$sb1 = amf_sb_new();
amf_sb_append($sb1,quot;prefixquot;);
amf_encode(quot;hello worldquot;,0,quot;quot;,$sb1); // store the result into the provided SB
echo(quot;returned type: quot; . $sb1 . quot;nquot;);
echo(quot;returned length: quot; . amf_sb_length($sb1) . quot;nquot;);

var_dump($contents);
Version Control
• cvsclient (not complete but works)
• perforce
• svn
SVN
• Maintainer: Alan Knowles
               Wez Furlong
                Scott MacVicar
• Type: Library Wrapper
• Library: libsvn
• Release: 0.4.1 beta 2008-06-24

• Description: Bindings for the Subversion revision
  control system, providing a method for
  manipulating a working copy or repository with
  PHP
Using SVN
<?php                                                       // svn_fs_is_file call:
// From user notes on PHP.net -                             print_r(svn_fs_is_file($fs_rev_handle, '/a-file.txt'));
 manipulating an actual repository
// Get a handle to the on-                                  // doing a diff
disk repository. Note that this                             list($diff, $errors) = svn_diff(
// is NOT a checked out project, but the a                         'http://www.example.com/svnroot/trunk/foo', SVN_REV
ctual svn repository!                                       ISION_HEAD,
$repos_handle = svn_repos_open('/var/lib/svn');                    'http://www.example.com/svnroot/branches/dev/foo', SV
$fs_handle = svn_repos_fs($repos_handle);                   N_REVISION_HEAD
                                                            );
// Now we need to open a revision because that's what the   if (!$diff) exit;
// svn_fs_* methods need. You'll probably $contents = '';
want the latest                                             while (!feof($diff)) {
// revision and we have a helper method fo $contents .= fread($diff, 8192);
r that.                                                     }
$youngest_rev = svn_fs_youngest_rev($fs_handle);            fclose($diff);
$fs_rev_handle = svn_fs_revision_root($fs_handle, $youngest fclose($errors);
_rev);                                                      var_dump($contents);
// Now we can actually start doing stuff, for example the

            Index: http://www.example.com/svnroot/trunk/foo
              ===============================================
              ==================== ---
              http://www.example.com/svnroot/trunk/foo (.../foo) (revision 23)
              +++ http://www.example.com/svnroot/branches/dev/foo (.../foo)
              (revision 27) // further diff output
Database Support
•   pdo_informix
•   pdo_ibm
•   paradox
•   odbtp
•   ingres
•   isis
•   notes
•   pdo_user – wait…what’s this?
PDO_USER
• Maintainer: Sara Golemon
               Ben Ramsey
• Type: Hybrid Craziness
• Release: 0.3.0 beta 2007-10-30

• Description: This extension provides a
  Userspace interface for PDO drivers
Using PDO_USER
• Defines two interfaces that your new PDO classes should implement,
PDO_User_Driver and PDO_User_Statement

• It also defines a Class called PDO_User with some static helper methods,
including a dsn parser and some sqlparser functions

• Documentation is available at
http://cvs.php.net/viewvc.cgi/pecl/pdo_user/README.OBJECTS?view=co

• It does NOT have hooks for the param binding data, so you can’t, for
example, use mysqli_prepare_statement since you can’t bind the parameters
properly

• Would be interesting to see this get some use and maybe even get into core
– imagine being able to write your db access in pdo even when a native pdo
driver doesn’t exist
Internationalization
•   translit
•   intl
•   fribidi
•   idn
Translit
•   Maintainer: Derick Rethans
•   Type: Provides Functionality
•   Release: 0.6.0 beta 2008-04-01
•   Homepage: http://derickrethans.nl/translit.php
•   Description: This extension allows you to transliterate
    text in non-latin characters (such as Chinese, Cyrillic,
    Greek etc) to latin characters. Besides the transliteration
    the extension also contains filters to upper- and
    lowercase latin, cyrillic and greek, and perform special
    forms of transliteration such as converting ligatures such
    as the Norwegian quot;æquot; to quot;aequot; and normalizing
    punctuation and spacing.
Using Translit
<?php
$string = file_get_contents('test-text.utf8');
$res = transliterate($string, array('han_transliterate', 'diacritical_remove'), 'utf-8', 'utf-8');
echo $res;

 Input
 ĀāĂ㥹ĆćĂ㥹ĈĉĆćĈĊĆćĈĉĊċĉĊċČČčĞğ
 大平矿难死者增至66人
 郑煤所属煤矿全停产

 Output
 AaAaAaCcCcCcCcDdDdEeEeEeEeEeGgGg
 dapingkuangnansǐzhezengzhi66ren
 zhengmeisuǒshǔmeikuangquantingchǎn
Text
•   bbcode
•   colorer
•   doublemetaphone
•   enchant
•   namazu
•   stem
•   xdiff
bbcode
•   Maintainer: Xavier De Cock
•   Type: Provides Functionality
•   Release: 1.0.2 stable 2008-08-18
•   Description: This is a quick and efficient BBCode Parsing
    Library.
    It provides various tag types, high speed tree based
    parsing,
    callback system, tag position restriction, Smiley
    Handling,
    Subparsing
    It will force closing BBCode tags in the good order, and
    closing
    terminating tags at the end of the string this is in order
    to ensure
    HTML Validity in all case.
Using bbcode
<?php
/*
  * Preparing RuleSet
  */
$arrayBBCode=array(
      'b'=>      array('type'=>BBCODE_TYPE_NOARG,
                                   'open_tag'=>'<b>', 'close_tag'=>'</b>'),   <i> Parser <b> Auto Correction
      'u'=>      array('type'=>BBCODE_TYPE_NOARG,
                                   'open_tag'=>'<u>', 'close_tag'=>'</u>'),     </b></i> at work <i> Parser
      'i'=>     array('type'=>BBCODE_TYPE_NOARG,
                                   'open_tag'=>'<i>', 'close_tag'=>'</i>'),
                                                                                <b> Auto Correction
);                                                                              </b></i><b> at work </b>
/*
  * Paired incorrectly nested BBCode                                            <i> Parser [b] Auto
  */
$text=quot;[i] Parser [b] Auto Correction [/i] at work [/b]nquot;;                     Correction </i> at work <i>
$BBHandler=bbcode_create($arrayBBCode);
echo bbcode_parse($BBHandler,$text);
                                                                                Parser <b> Auto Correction
// Enabling reopening of automaticaly closed elements                           </b></i><b> at work </b>
bbcode_set_flags($BBHandler,BBCODE_CORRECT_REOPEN_TAGS,
                           BBCODE_SET_FLAGS_SET);
echo bbcode_parse($BBHandler,$text);
/*
  * Unpaired incorrectly nested BBCode
  */
$text=quot;[i] Parser [b] Auto Correction [/i] at worknquot;;
echo bbcode_parse($BBHandler,$text);
// Enabling automatic close of pending tags
bbcode_set_flags($BBHandler,
                          BBCODE_CORRECT_REOPEN_TAGS|BBCO
DE_AUTO_CORRECT,
                          BBCODE_SET_FLAGS_SET);
echo bbcode_parse($BBHandler,$text);
Search
•   clucene
•   mnogosearch
•   swish
•   sphinx
Sphinx
• Maintainer: Antony Dovgal
• Type: Library Wrapper
• Library: libsphinx
  http://www.sphinxsearch.com/
• Release: 0.2.0 beta 2008-07-31
• Description: This extension provides bindings
  for libsphinxclient, client library for Sphinx
Using Sphinx
                                    array(10) {
                                      [quot;errorquot;]=>
                                      string(0) quot;quot;
                                      [quot;warningquot;]=>
                                      string(0) quot;quot;
                                      [quot;statusquot;]=>
<?php                                 int(0)
                                      [quot;fieldsquot;]=>
                                      array(3) {
                                        [0]=>
                                        string(7) quot;subjectquot;
$s = new SphinxClient;                  [1]=>
                                        string(4) quot;bodyquot;

$s->setServer(quot;localhostquot;, 6712);       [2]=>
                                        string(6) quot;authorquot;
                                      }
$s->setMatchMode(SPH_MATCH_ANY);      [quot;attrsquot;]=>
                                      array(0) {

$s->setMaxQueryTime(3);               }
                                      [quot;matchesquot;]=>
                                      array(1) {
                                        [3]=>
                                        array(2) {

$result = $s->query(quot;testquot;);              [quot;weightquot;]=>
                                          int(1)
                                          [quot;attrsquot;]=>
                                          array(0) {
                                          }

var_dump($result);                    }
                                        }

                                      [quot;totalquot;]=>
                                      int(1)
                                      [quot;total_foundquot;]=>
                                      int(1)
                                      [quot;timequot;]=>
                                      float(0)
                                      [quot;wordsquot;]=>
                                      array(1) {
                                        [quot;toquot;]=>
                                        array(2) {
                                          [quot;docsquot;]=>
                                          int(1)
                                          [quot;hitsquot;]=>
                                          int(1)
                                        }
                                      }
                                    }
PHP – do bad things
•   runkit
•   funcall
•   intercept
•   operator
Runkit
• Maintainer: Sara Golemon
• Type: Engine Manipulation
• Release: 0.9 beta 2006-06-06

• Description: Replace, rename, and remove user
  defined functions and classes.
  Define customized superglobal variables for
  general purpose use.
  Execute code in restricted environment
  (sandboxing)
Using Runkit
<?php
runkit_function_add('testme','$a,$b','echo quot;The value of a is $anquot;; echo quot;The value of b is $bnquot;;');
testme(1,2);
function original() {
   echo quot;In a functionnquot;;
}
runkit_function_copy('original','duplicate');
original();
duplicate();
                                                                                   The value of a is 1
function testme() {
   echo quot;Original Testme Implementationnquot;;                                        The value of b is 2
}
testme();
runkit_function_redefine('testme','','echo quot;New Testme Implementationnquot;;');
testme();                                                                          In a function
class Example {
    function foo() {
                                                                                   In a function
        echo quot;foo!nquot;;
    }
}                                                                                  Original Testme Implementation
// create an Example object
$e = new Example();
                                                                                   New Testme Implementation
// Add a new public method
runkit_method_add(
      'Example',
                                                                                   16
      'add',
      '$num1, $num2',
      'return $num1 + $num2;',
      RUNKIT_ACC_PUBLIC
);
// add 12 + 4
echo $e->add(12, 4);
Funcall
•   Maintainer: Surf Chen
•   Type: Engine Manipulation
•   Release: 0.2.1 stable 2008-04-07
•   Site: http://code.google.com/p/funcall/

• Description: Call callbacks before or after
  specified functions/methods being called
Using Funcall
<?php                                          var_dump($result);
function my_func($arg1,$arg2) {                echo 'step 003 (cost:',$process_time
      usleep(20000);                    ,quot;)nquot;;
      echo quot;step 002nquot;;                }
      return $arg1.$arg2;
}                                       fc_add_pre('my_func','pre_cb');
class my_class {                        fc_add_post('my_func','post_cb');
      function f1() {                   my_func('php','c');
            return true;
      }                                 fc_add_post('trim','post_cb');
}                                       echo trim(quot;abcnquot;);
function pre_cb($args) {
      var_dump($args);                  fc_add_pre('my_class::f1','pre_cb');
      echo quot;step 001nquot;;                fc_add_post('my_class::f1','post_cb');
}                                       $my_class=new my_class;
function post_cb($args,$result,$process $my_class->f1();
_time) {
      var_dump($args);                  var_dump(fc_list());
Intercept
• Maintainer: Gabriel Ricard
• Type: Engine Manipulation
• Release: 0.3.0 alpha 2005-05-28

• Description: Allows the user to have a user-
  space function called when the specified
  function or method is called
Using Intercept
<?php

function myfunc() {
      echo quot;this is my functionquot;;                    before myfunc()
}                                                    this is my function
                                                     after myfunc()
function pre_myfunc() {
    echo quot;before myfunc()quot;;
}

function post_myfunc() {
    echo quot;after myfunc()quot;;
}

intercept_add('myfunc', 'pre_myfunc', PRE_INTERCEPT);
intercept_add('myfunc', 'post_myfunc', POST_INTERCEPT);

myfunc();
Operator
• Maintainer: Sara Golemon
• Type: Engine Manipulation
• Release: 0.3 beta 2006-02-08

• Description: Operator overloading for: +, -, *, /,
  %, <<, >>, ., |, &, ^, ~, !, ++, --,
  +=, -=, *=, /=, %=, <<=, >>=, .=, |=, &=, ^=, ~=,
  ==, !=, ===, !==, <, and <= operators.
  Conditional support for > and >= available with
  application of a patch.
Using Operator
<?php                                           }
class foo {
      private $value;                           function __construct($init) {
                                                    $this->value = $init;
     function __is_identical($val) {            }
         return $this->value === $val;     }
     }
                                           $c = new foo(5);             bool(true)
     function __is_not_identical($val) {
         return $this->value !== $val;     var_dump($c === 5);          bool(false)
     }                                     var_dump($c === '5');        bool(false)
                                           var_dump($c !== 5);
     function __is_equal($val) {           var_dump($c !== '5');        bool(true)
         return $this->value == $val;      var_dump($c == 5);           bool(true)
     }                                     var_dump($c == '5');         bool(true)
                                           var_dump($c == 6);
     function __is_not_equal($val) {       var_dump($c != 5);           bool(false)
         return $this->value != $val;      var_dump($c != '5');         bool(false)
     }                                     var_dump($c != 6);
                                           var_dump($c < 5);            bool(false)
     function __is_smaller($val) {         var_dump($c < 6);            bool(true)
         return $this->value < $val;       var_dump($c <= 5);           bool(false)
     }                                     var_dump($c <= 4);
                                                                        bool(true)
     function __is_smaller_or_equal($val                                bool(true)
){
         return $this->value <= $val;                                   bool(false)
Typehinting Help
• params
• spl_types
spl_types
• Maintainer: Marcus Börger
               David Coallier
• Type: Additional Functionality
• Release: 0.3.0 stable 2008-01-13

• Description: SPL Types is a collection of special
  typehandling classes
Using spl_types
<?php                                                class EnumOne extends SplEnum {
$int = new SplInt(94);                                     const __default = 1;
                                                     }
try {
    $int = 'Try to cast a string value for fun'; class EnumTwo extends SplEnum {
} catch (UnexpectedValueException $uve)              const __default = 2;
{                                                }
    echo $uve->getMessage() . PHP_EOL;
}                                                class EnumThree extends SplEnum {
                                                     const __default = 3;
echo $int; // Outputs 94                         }
$float = new SplFloat(3.154);                        $enumOne = new EnumOne();
$newFloat = new SplFloat(3);                         $enumTwo = new EnumTwo();
                                                     $enumThree = new EnumThree();
try {
    $float = 'Try to cast a string value for fun';
} catch (UnexpectedValueException $uve)              echo $enumOne; // outputs 1
{                                                    echo $enumTwo; // outputs 2
    echo $uve->getMessage() . PHP_EOL;               echo $enumThree; // outputs 3
}                                                    ($c <= 4);
echo $float; // Outputs 3.154
echo $newFloat; // Outputs 3
params
• Maintainer: Sara Golemon
• Type: Additional Functionality
• Release: 1.0 stable 2007-11-13

• Description: Userspace equivalent of
  zend_parse_parameters()
Using params
Params Extension
----------------                                                                      <?php
                                                                                      function example() {
Array params_parse(string $format, ...);                                                    list($foo, $bar, $baz) = params_parse(quot;slrquot;);
                                                                                            // $foo will be a string
$format is a type specifier string containin one or more of the following type              // $bar will be a long (integer)
specifiers:                                                                                 // $baz will be a resource
                                                                                      }
b                  The parameter will be converted to boolean and added to the
output stack                                                                           function ex2() {
l                  The parameter will be converted to long (integer) and added to           list($foo, $bar, $baz) = params_parse(quot;O|lbquot;, quot;stdClassquot;);
the output stack                                                                            // $foo will be an object of type stdClass
d                  The parameter will be converted to double (float) and added to           // $bar will be a long (integer), with a default va
the output stack                                                                       lue of 0
s                  The parameter will be converted to string and added to the output        // $baz will be a double (float), with a default va
stack                                                                                  lue of 0.0
a                  The parameter will be converted to array and added to the output }
stack
o                  The parameter will be converted to an object and added to the function ex3() {
output stack                                                                                list($foo) = params_parse(quot;Oquot;, array(quot;Aquot;, quot;Bquot;, quot;Cquot;));
O                  The parameter must be an object of the type(s) specified by the          // $foo will be an object of type A, B, or C
next argument to params_parse()                                                        }
r                  The parameter must be a resource (of any type)
R                  The parameter must be a resource of the type(s) specified by the function ex4() {
next argument to params_parse()                                                             list($foo) = params_parse(quot;Oquot;, true);
z                  The parameter will be added to the output stack regardless of            // $foo will be an object of any type, but must be passed as an object (will not
type                                                                                   be converted)
*                  The output stack will be populated with an array containing a       }
variable number of arguments as passed
+                  Same as '*' but at least one var-arg is required                    function ex5() {
                                                                                            list($fp, $obj) = params_parse(quot;ROquot;, quot;streamquot;, quot;stdClassquot;);
A single pipe '|' may be used in the format specifier to split required arguments           // $fp will be a stream (file) resource
from optional arguments.                                                                    // $obj will be an object of type stdClass
                                                                                       }
If params_parse() is unable to return the requested types (because of 'r', 'R', or 'O'
type checking failures or insufficient args), it will return false.
Debugging Tools
• xdebug
• inclued (yes that’s spelled right)
• apd
XDebug
• Maintainer: Derick Rethans
• Type: Debugging
• Release: 2.0.3 stable 2008-04-09

• Description: The Xdebug extension helps you debugging your script by
  providing a lot of
  valuable debug information. The debug information that Xdebug can
  provide
  includes the following:
  * stack and function traces in error messages with:
  o full parameter display for user defined functions
  o function name, file name and line indications
  o support for member functions
  * memory allocation
  * protection for infinite recursions
  Xdebug also provides:
  * profiling information for PHP scripts
  * code coverage analysis
  * capabilities to debug your scripts interactively with a debug client
Using Xdebug
Xdebug has many features

1.   Displays stack traces on error
2.   Maximum nesting level protection
3.   Time tracking
4.   Pretty variable dumping (var_dump and friends)
5.   Stack traces
6.   Function traces
7.   Code Coverage
8.   Profiling
9.   Remote Debugging
SSH2
•   Maintainer: Sara Golemon
•   Type: Library Wrapper
•   Library: http://www.libssh2.org
•   Release: 0.10 beta 2005-11-01

• Provides bindings to the functions of libssh2
  which implements the SSH2 protocol.
  libssh2 is available from
  http://www.sourceforge.net/projects/libssh2
Using SSH2
<?php
$connection = ssh2_connect('shell.example.com', 22);
ssh2_auth_password($connection, 'username', 'password');

$sftp = ssh2_sftp($connection);

$stream = fopen(quot;ssh2.sftp://$sftp/path/to/filequot;, 'r');
$connection = ssh2_connect('shell.example.com', 22);
ssh2_auth_password($connection, 'username', 'password');

$stream = ssh2_shell($connection, 'vt102', null, 80, 24, SSH2
_TERM_UNIT_CHARS);
Docblock
• Maintainer: Greg Beaver
• Type: Additional Functionality
• Release: 0.2.0 alpha 2006-06-27

• Description This extension is like the tokenizer extension for PHP.
  It takes a document comment (docblock) like this one:
  /**
  * information {@inlinetag}
  * @tags
  */
  and parses it into tokens.
  The primary function is docblock_tokenize(), which accepts a
  string, and returns an array of arrays of array(TOKEN, quot;tokenquot;).
  TOKEN is one of DOCBLOCK_* constants.
  docblock_tokenize() has an optional second bool parameter that
  determine whether to output non-essential tokens like
  the /** * stuff.
  docblock_token_name() takes a DOCBLOCK_* constant and returns its
Using DocBlock
<?php
docblock_tokenize(
     quot;/**
       * hi there
       * @author Greg Beaver <cellog@php.net>
       * @version 1.0.0
       */quot;);
   quot;DOCBLOCK_COMMENTSTARTquot;       quot; Greg Beaver <cellog@php.net>quot;
   quot;/**quot;                         quot;DOCBLOCK_NEWLINEquot;
   quot;DOCBLOCK_NEWLINEquot;            quot;
   quot;DOCBLOCK_TEXTquot;              quot;
   quot;hi therequot;                    quot;DOCBLOCK_ASTERISKquot;
   quot;DOCBLOCK_NEWLINEquot;            quot;*quot;
   quot;                             quot;DOCBLOCK_WHITESPACEquot;
  quot;                              quot;quot;
   quot;DOCBLOCK_ASTERISKquot;           quot;DOCBLOCK_TAGquot;
   quot;*quot;                           quot;@versionquot;
   quot;DOCBLOCK_WHITESPACEquot;         quot;DOCBLOCK_TEXTquot;
   quot;quot;                            quot; 1.0.0quot;
   quot;DOCBLOCK_TAGquot;                quot;DOCBLOCK_COMMENTENDquot;
   quot;@authorquot;                     quot;*/quot;
   quot;DOCBLOCK_TEXTquot;
Language Embedding
•   java
•   lua
•   perl
•   Python
Embedded Python
• Maintainer: Jon Parise
• Type: Language Embedded
• Release: 0.8.0 alpha 2008-02-17

• Description: This extension allows the Python
  interpreter to be embedded inside of PHP,
  allowing for the instantiate and manipulation of
  Python objects from within PHP
Using Embedded Python
<?php
$a = quot;testquot;;
$b = true;                test 1 50 60.4
$c = 50;                  test 2.208 test
$d = 60.4;

$code = <<<EOD
import php

a   =   php.var('a')    http://www.csh.rit.edu/~jon/projects/pip/
b   =   php.var('b')    More information on how to use it
c   =   php.var('c')
d   =   php.var('d')

print a, b, c, d
print a, d / c + b, a
EOD;

py_eval($code);
My “Please adopt me” wishlist
• preprocessor
• intercept/funcall with full features
• threads
Extension do exist outside of PECL
Phurple        libpurple bindings         http://sourceforge.net/projects/phurple/
Xcache         opcode cache               http://xcache.lighttpd.net/
php-gtk        gui                        http://gtk.php.net
php-qt         gui                        http://php-qt.org/
ioncube        encoder and opcode cache   http://www.ioncube.com/
zend           encoder and opcode cache   http://zend.com
IRCG           xml streaming              http://schumann.cx/ircg/index.php
midgard        cms functionality          http://www.midgard-project.org

suhosin        security                   http://www.hardened-php.net/suhosin/

blitz          templating                 http://alexeyrybak.com/blitz/blitz_en.html
dbg            debugging                  http://dd.cron.ru/dbg/
eaccelerator   opcode cache               http://eaccelerator.net/
                                          http://www.microsoft.com/sql/technologies/ph
sqlsrv         db extension               p/default.mspx

ffmpeg-php     Wrapper for ffmpeg lib     http://ffmpeg-php.sourceforge.net/
Resources
 • Slides
   • http://elizabethmariesmith.com/slides/pecl-picks.pdf
 • PECL
   • http://pecl.php.net
   • http://news.php.net/article.php?group=php.pecl.dev&article
     =5
   • http://marc.info/?l=pecl-dev
 • Me
   • http://elizabethmariesmith.com
   • auroraeosrose@php.net

 • Information from http://php.net , http://cvs.php.net and
   http://pecl.php.net – documentation, extension examples,
   and occasionally phpt tests - thanks to all who work on PHP

                           THANKS

Mais conteúdo relacionado

Mais procurados

O que há de novo no Rails 3
O que há de novo no Rails 3O que há de novo no Rails 3
O que há de novo no Rails 3Hugo Baraúna
 
How to develop Jenkins plugin using to ruby and Jenkins.rb
How to develop Jenkins plugin using to ruby and Jenkins.rbHow to develop Jenkins plugin using to ruby and Jenkins.rb
How to develop Jenkins plugin using to ruby and Jenkins.rbHiroshi SHIBATA
 
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & HadoopPuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & HadoopWalter Heck
 
Puppet at Pinterest
Puppet at PinterestPuppet at Pinterest
Puppet at PinterestPuppet
 
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
 
Scalable Django Architecture
Scalable Django ArchitectureScalable Django Architecture
Scalable Django ArchitectureRami Sayar
 
30 Minutes To CPAN
30 Minutes To CPAN30 Minutes To CPAN
30 Minutes To CPANdaoswald
 
PSGI and Plack from first principles
PSGI and Plack from first principlesPSGI and Plack from first principles
PSGI and Plack from first principlesPerl Careers
 
Puppet at GitHub / ChatOps
Puppet at GitHub / ChatOpsPuppet at GitHub / ChatOps
Puppet at GitHub / ChatOpsPuppet
 
Puppet for dummies - ZendCon 2011 Edition
Puppet for dummies - ZendCon 2011 EditionPuppet for dummies - ZendCon 2011 Edition
Puppet for dummies - ZendCon 2011 EditionJoshua Thijssen
 
Security Goodness with Ruby on Rails
Security Goodness with Ruby on RailsSecurity Goodness with Ruby on Rails
Security Goodness with Ruby on RailsSource Conference
 
ZFConf 2012: Dependency Management в PHP и Zend Framework 2 (Кирилл Чебунин)
ZFConf 2012: Dependency Management в PHP и Zend Framework 2 (Кирилл Чебунин)ZFConf 2012: Dependency Management в PHP и Zend Framework 2 (Кирилл Чебунин)
ZFConf 2012: Dependency Management в PHP и Zend Framework 2 (Кирилл Чебунин)ZFConf Conference
 
PHP & JavaScript & CSS Coding style
PHP & JavaScript & CSS Coding stylePHP & JavaScript & CSS Coding style
PHP & JavaScript & CSS Coding styleBo-Yi Wu
 
Building a desktop app with HTTP::Engine, SQLite and jQuery
Building a desktop app with HTTP::Engine, SQLite and jQueryBuilding a desktop app with HTTP::Engine, SQLite and jQuery
Building a desktop app with HTTP::Engine, SQLite and jQueryTatsuhiko Miyagawa
 
parenscript-tutorial
parenscript-tutorialparenscript-tutorial
parenscript-tutorialtutorialsruby
 
Php on the Web and Desktop
Php on the Web and DesktopPhp on the Web and Desktop
Php on the Web and DesktopElizabeth Smith
 
Puppet getting started by Dirk Götz
Puppet getting started by Dirk GötzPuppet getting started by Dirk Götz
Puppet getting started by Dirk GötzNETWAYS
 

Mais procurados (20)

O que há de novo no Rails 3
O que há de novo no Rails 3O que há de novo no Rails 3
O que há de novo no Rails 3
 
How to develop Jenkins plugin using to ruby and Jenkins.rb
How to develop Jenkins plugin using to ruby and Jenkins.rbHow to develop Jenkins plugin using to ruby and Jenkins.rb
How to develop Jenkins plugin using to ruby and Jenkins.rb
 
Intro to-puppet
Intro to-puppetIntro to-puppet
Intro to-puppet
 
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & HadoopPuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
 
Puppet at Pinterest
Puppet at PinterestPuppet at Pinterest
Puppet at Pinterest
 
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
 
Scalable Django Architecture
Scalable Django ArchitectureScalable Django Architecture
Scalable Django Architecture
 
30 Minutes To CPAN
30 Minutes To CPAN30 Minutes To CPAN
30 Minutes To CPAN
 
PSGI and Plack from first principles
PSGI and Plack from first principlesPSGI and Plack from first principles
PSGI and Plack from first principles
 
Plack at YAPC::NA 2010
Plack at YAPC::NA 2010Plack at YAPC::NA 2010
Plack at YAPC::NA 2010
 
Puppet at GitHub / ChatOps
Puppet at GitHub / ChatOpsPuppet at GitHub / ChatOps
Puppet at GitHub / ChatOps
 
Puppet for dummies - ZendCon 2011 Edition
Puppet for dummies - ZendCon 2011 EditionPuppet for dummies - ZendCon 2011 Edition
Puppet for dummies - ZendCon 2011 Edition
 
Security Goodness with Ruby on Rails
Security Goodness with Ruby on RailsSecurity Goodness with Ruby on Rails
Security Goodness with Ruby on Rails
 
ZFConf 2012: Dependency Management в PHP и Zend Framework 2 (Кирилл Чебунин)
ZFConf 2012: Dependency Management в PHP и Zend Framework 2 (Кирилл Чебунин)ZFConf 2012: Dependency Management в PHP и Zend Framework 2 (Кирилл Чебунин)
ZFConf 2012: Dependency Management в PHP и Zend Framework 2 (Кирилл Чебунин)
 
Intro to PSGI and Plack
Intro to PSGI and PlackIntro to PSGI and Plack
Intro to PSGI and Plack
 
PHP & JavaScript & CSS Coding style
PHP & JavaScript & CSS Coding stylePHP & JavaScript & CSS Coding style
PHP & JavaScript & CSS Coding style
 
Building a desktop app with HTTP::Engine, SQLite and jQuery
Building a desktop app with HTTP::Engine, SQLite and jQueryBuilding a desktop app with HTTP::Engine, SQLite and jQuery
Building a desktop app with HTTP::Engine, SQLite and jQuery
 
parenscript-tutorial
parenscript-tutorialparenscript-tutorial
parenscript-tutorial
 
Php on the Web and Desktop
Php on the Web and DesktopPhp on the Web and Desktop
Php on the Web and Desktop
 
Puppet getting started by Dirk Götz
Puppet getting started by Dirk GötzPuppet getting started by Dirk Götz
Puppet getting started by Dirk Götz
 

Semelhante a PECL Extensions to Boost Your PHP

Facebook的缓存系统
Facebook的缓存系统Facebook的缓存系统
Facebook的缓存系统yiditushe
 
4069180 Caching Performance Lessons From Facebook
4069180 Caching Performance Lessons From Facebook4069180 Caching Performance Lessons From Facebook
4069180 Caching Performance Lessons From Facebookguoqing75
 
Apache and PHP: Why httpd.conf is your new BFF!
Apache and PHP: Why httpd.conf is your new BFF!Apache and PHP: Why httpd.conf is your new BFF!
Apache and PHP: Why httpd.conf is your new BFF!Jeff Jones
 
Hiveminder - Everything but the Secret Sauce
Hiveminder - Everything but the Secret SauceHiveminder - Everything but the Secret Sauce
Hiveminder - Everything but the Secret SauceJesse Vincent
 
Beijing Perl Workshop 2008 Hiveminder Secret Sauce
Beijing Perl Workshop 2008 Hiveminder Secret SauceBeijing Perl Workshop 2008 Hiveminder Secret Sauce
Beijing Perl Workshop 2008 Hiveminder Secret SauceJesse Vincent
 
Introduction to PHP 5.3
Introduction to PHP 5.3Introduction to PHP 5.3
Introduction to PHP 5.3guestcc91d4
 
What's up with Prototype and script.aculo.us?
What's up with Prototype and script.aculo.us?What's up with Prototype and script.aculo.us?
What's up with Prototype and script.aculo.us?Christophe Porteneuve
 
Xdebug - Derick Rethans - Barcelona PHP Conference 2008
Xdebug - Derick Rethans - Barcelona PHP Conference 2008Xdebug - Derick Rethans - Barcelona PHP Conference 2008
Xdebug - Derick Rethans - Barcelona PHP Conference 2008phpbarcelona
 
Eclipse Pdt2.0 26.05.2009
Eclipse Pdt2.0 26.05.2009Eclipse Pdt2.0 26.05.2009
Eclipse Pdt2.0 26.05.2009Bastian Feder
 
The symfony platform: Create your very own framework (PHP Quebec 2008)
The symfony platform: Create your very own framework (PHP Quebec 2008)The symfony platform: Create your very own framework (PHP Quebec 2008)
The symfony platform: Create your very own framework (PHP Quebec 2008)Fabien Potencier
 
Auto-loading of Drupal CCK Nodes
Auto-loading of Drupal CCK NodesAuto-loading of Drupal CCK Nodes
Auto-loading of Drupal CCK Nodesnihiliad
 
HackU PHP and Node.js
HackU PHP and Node.jsHackU PHP and Node.js
HackU PHP and Node.jssouridatta
 
PHP & Performance
PHP & PerformancePHP & Performance
PHP & Performance毅 吕
 
WordPress Performance & Scalability
WordPress Performance & ScalabilityWordPress Performance & Scalability
WordPress Performance & ScalabilityJoseph Scott
 
Practical Chef and Capistrano for Your Rails App
Practical Chef and Capistrano for Your Rails AppPractical Chef and Capistrano for Your Rails App
Practical Chef and Capistrano for Your Rails AppSmartLogic
 

Semelhante a PECL Extensions to Boost Your PHP (20)

Pecl Picks
Pecl PicksPecl Picks
Pecl Picks
 
Facebook的缓存系统
Facebook的缓存系统Facebook的缓存系统
Facebook的缓存系统
 
4069180 Caching Performance Lessons From Facebook
4069180 Caching Performance Lessons From Facebook4069180 Caching Performance Lessons From Facebook
4069180 Caching Performance Lessons From Facebook
 
Api Design
Api DesignApi Design
Api Design
 
Apache and PHP: Why httpd.conf is your new BFF!
Apache and PHP: Why httpd.conf is your new BFF!Apache and PHP: Why httpd.conf is your new BFF!
Apache and PHP: Why httpd.conf is your new BFF!
 
Memcached Study
Memcached StudyMemcached Study
Memcached Study
 
Hiveminder - Everything but the Secret Sauce
Hiveminder - Everything but the Secret SauceHiveminder - Everything but the Secret Sauce
Hiveminder - Everything but the Secret Sauce
 
Beijing Perl Workshop 2008 Hiveminder Secret Sauce
Beijing Perl Workshop 2008 Hiveminder Secret SauceBeijing Perl Workshop 2008 Hiveminder Secret Sauce
Beijing Perl Workshop 2008 Hiveminder Secret Sauce
 
Introduction to PHP 5.3
Introduction to PHP 5.3Introduction to PHP 5.3
Introduction to PHP 5.3
 
What's up with Prototype and script.aculo.us?
What's up with Prototype and script.aculo.us?What's up with Prototype and script.aculo.us?
What's up with Prototype and script.aculo.us?
 
Os Wilhelm
Os WilhelmOs Wilhelm
Os Wilhelm
 
Xdebug - Derick Rethans - Barcelona PHP Conference 2008
Xdebug - Derick Rethans - Barcelona PHP Conference 2008Xdebug - Derick Rethans - Barcelona PHP Conference 2008
Xdebug - Derick Rethans - Barcelona PHP Conference 2008
 
Eclipse Pdt2.0 26.05.2009
Eclipse Pdt2.0 26.05.2009Eclipse Pdt2.0 26.05.2009
Eclipse Pdt2.0 26.05.2009
 
The symfony platform: Create your very own framework (PHP Quebec 2008)
The symfony platform: Create your very own framework (PHP Quebec 2008)The symfony platform: Create your very own framework (PHP Quebec 2008)
The symfony platform: Create your very own framework (PHP Quebec 2008)
 
Auto-loading of Drupal CCK Nodes
Auto-loading of Drupal CCK NodesAuto-loading of Drupal CCK Nodes
Auto-loading of Drupal CCK Nodes
 
HackU PHP and Node.js
HackU PHP and Node.jsHackU PHP and Node.js
HackU PHP and Node.js
 
PHP & Performance
PHP & PerformancePHP & Performance
PHP & Performance
 
WordPress Performance & Scalability
WordPress Performance & ScalabilityWordPress Performance & Scalability
WordPress Performance & Scalability
 
Practical Chef and Capistrano for Your Rails App
Practical Chef and Capistrano for Your Rails AppPractical Chef and Capistrano for Your Rails App
Practical Chef and Capistrano for Your Rails App
 
Revoke-Obfuscation
Revoke-ObfuscationRevoke-Obfuscation
Revoke-Obfuscation
 

Mais de ZendCon

Framework Shootout
Framework ShootoutFramework Shootout
Framework ShootoutZendCon
 
Zend_Tool: Practical use and Extending
Zend_Tool: Practical use and ExtendingZend_Tool: Practical use and Extending
Zend_Tool: Practical use and ExtendingZendCon
 
PHP on IBM i Tutorial
PHP on IBM i TutorialPHP on IBM i Tutorial
PHP on IBM i TutorialZendCon
 
PHP on Windows - What's New
PHP on Windows - What's NewPHP on Windows - What's New
PHP on Windows - What's NewZendCon
 
PHP and Platform Independance in the Cloud
PHP and Platform Independance in the CloudPHP and Platform Independance in the Cloud
PHP and Platform Independance in the CloudZendCon
 
I18n with PHP 5.3
I18n with PHP 5.3I18n with PHP 5.3
I18n with PHP 5.3ZendCon
 
Cloud Computing: The Hard Problems Never Go Away
Cloud Computing: The Hard Problems Never Go AwayCloud Computing: The Hard Problems Never Go Away
Cloud Computing: The Hard Problems Never Go AwayZendCon
 
Planning for Synchronization with Browser-Local Databases
Planning for Synchronization with Browser-Local DatabasesPlanning for Synchronization with Browser-Local Databases
Planning for Synchronization with Browser-Local DatabasesZendCon
 
Magento - a Zend Framework Application
Magento - a Zend Framework ApplicationMagento - a Zend Framework Application
Magento - a Zend Framework ApplicationZendCon
 
Enterprise-Class PHP Security
Enterprise-Class PHP SecurityEnterprise-Class PHP Security
Enterprise-Class PHP SecurityZendCon
 
PHP and IBM i - Database Alternatives
PHP and IBM i - Database AlternativesPHP and IBM i - Database Alternatives
PHP and IBM i - Database AlternativesZendCon
 
Zend Core on IBM i - Security Considerations
Zend Core on IBM i - Security ConsiderationsZend Core on IBM i - Security Considerations
Zend Core on IBM i - Security ConsiderationsZendCon
 
Application Diagnosis with Zend Server Tracing
Application Diagnosis with Zend Server TracingApplication Diagnosis with Zend Server Tracing
Application Diagnosis with Zend Server TracingZendCon
 
Insights from the Experts: How PHP Leaders Are Transforming High-Impact PHP A...
Insights from the Experts: How PHP Leaders Are Transforming High-Impact PHP A...Insights from the Experts: How PHP Leaders Are Transforming High-Impact PHP A...
Insights from the Experts: How PHP Leaders Are Transforming High-Impact PHP A...ZendCon
 
Solving the C20K problem: Raising the bar in PHP Performance and Scalability
Solving the C20K problem: Raising the bar in PHP Performance and ScalabilitySolving the C20K problem: Raising the bar in PHP Performance and Scalability
Solving the C20K problem: Raising the bar in PHP Performance and ScalabilityZendCon
 
Joe Staner Zend Con 2008
Joe Staner Zend Con 2008Joe Staner Zend Con 2008
Joe Staner Zend Con 2008ZendCon
 
Tiery Eyed
Tiery EyedTiery Eyed
Tiery EyedZendCon
 
Make your PHP Application Software-as-a-Service (SaaS) Ready with the Paralle...
Make your PHP Application Software-as-a-Service (SaaS) Ready with the Paralle...Make your PHP Application Software-as-a-Service (SaaS) Ready with the Paralle...
Make your PHP Application Software-as-a-Service (SaaS) Ready with the Paralle...ZendCon
 
DB2 Storage Engine for MySQL and Open Source Applications Session
DB2 Storage Engine for MySQL and Open Source Applications SessionDB2 Storage Engine for MySQL and Open Source Applications Session
DB2 Storage Engine for MySQL and Open Source Applications SessionZendCon
 
Digital Identity
Digital IdentityDigital Identity
Digital IdentityZendCon
 

Mais de ZendCon (20)

Framework Shootout
Framework ShootoutFramework Shootout
Framework Shootout
 
Zend_Tool: Practical use and Extending
Zend_Tool: Practical use and ExtendingZend_Tool: Practical use and Extending
Zend_Tool: Practical use and Extending
 
PHP on IBM i Tutorial
PHP on IBM i TutorialPHP on IBM i Tutorial
PHP on IBM i Tutorial
 
PHP on Windows - What's New
PHP on Windows - What's NewPHP on Windows - What's New
PHP on Windows - What's New
 
PHP and Platform Independance in the Cloud
PHP and Platform Independance in the CloudPHP and Platform Independance in the Cloud
PHP and Platform Independance in the Cloud
 
I18n with PHP 5.3
I18n with PHP 5.3I18n with PHP 5.3
I18n with PHP 5.3
 
Cloud Computing: The Hard Problems Never Go Away
Cloud Computing: The Hard Problems Never Go AwayCloud Computing: The Hard Problems Never Go Away
Cloud Computing: The Hard Problems Never Go Away
 
Planning for Synchronization with Browser-Local Databases
Planning for Synchronization with Browser-Local DatabasesPlanning for Synchronization with Browser-Local Databases
Planning for Synchronization with Browser-Local Databases
 
Magento - a Zend Framework Application
Magento - a Zend Framework ApplicationMagento - a Zend Framework Application
Magento - a Zend Framework Application
 
Enterprise-Class PHP Security
Enterprise-Class PHP SecurityEnterprise-Class PHP Security
Enterprise-Class PHP Security
 
PHP and IBM i - Database Alternatives
PHP and IBM i - Database AlternativesPHP and IBM i - Database Alternatives
PHP and IBM i - Database Alternatives
 
Zend Core on IBM i - Security Considerations
Zend Core on IBM i - Security ConsiderationsZend Core on IBM i - Security Considerations
Zend Core on IBM i - Security Considerations
 
Application Diagnosis with Zend Server Tracing
Application Diagnosis with Zend Server TracingApplication Diagnosis with Zend Server Tracing
Application Diagnosis with Zend Server Tracing
 
Insights from the Experts: How PHP Leaders Are Transforming High-Impact PHP A...
Insights from the Experts: How PHP Leaders Are Transforming High-Impact PHP A...Insights from the Experts: How PHP Leaders Are Transforming High-Impact PHP A...
Insights from the Experts: How PHP Leaders Are Transforming High-Impact PHP A...
 
Solving the C20K problem: Raising the bar in PHP Performance and Scalability
Solving the C20K problem: Raising the bar in PHP Performance and ScalabilitySolving the C20K problem: Raising the bar in PHP Performance and Scalability
Solving the C20K problem: Raising the bar in PHP Performance and Scalability
 
Joe Staner Zend Con 2008
Joe Staner Zend Con 2008Joe Staner Zend Con 2008
Joe Staner Zend Con 2008
 
Tiery Eyed
Tiery EyedTiery Eyed
Tiery Eyed
 
Make your PHP Application Software-as-a-Service (SaaS) Ready with the Paralle...
Make your PHP Application Software-as-a-Service (SaaS) Ready with the Paralle...Make your PHP Application Software-as-a-Service (SaaS) Ready with the Paralle...
Make your PHP Application Software-as-a-Service (SaaS) Ready with the Paralle...
 
DB2 Storage Engine for MySQL and Open Source Applications Session
DB2 Storage Engine for MySQL and Open Source Applications SessionDB2 Storage Engine for MySQL and Open Source Applications Session
DB2 Storage Engine for MySQL and Open Source Applications Session
 
Digital Identity
Digital IdentityDigital Identity
Digital Identity
 

Último

08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
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
 
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
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
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
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
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
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 

Último (20)

08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
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
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
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
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
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
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 

PECL Extensions to Boost Your PHP

  • 1. PECL Picks Extensions to make your life better
  • 2. Who am I? • Elizabeth Marie Smith aka auroraeosrose • Pink is good • I hate computers • I love programming • Windows will not kill you • Work at OmniTI (http://omniti.com) • Contributor on various open source projects (including PHP, PECL and PHP-GTK)
  • 3. No, it’s not a cucumber soaked in brine…
  • 4. What is PECL? • PHP Extension Code Library • The place for PHP extensions • Benefits: ▫ snapshot builds and win32 build support ▫ code hosting and distribution ▫ pecl install (PEAR packaging and installer support) ▫ community ▫ advertising • No GPL code – license should be PHP license compatible (LGPL ok)
  • 5. History • Split off from PEAR in 2003 • Wez Furlong is “instigator” ▫ see famous letter ▫ http://news.php.net/article.php?group=php.pecl. dev&article=5 • Many of the points raised still need work – mainly PECL needs manpower, bodies to do the work
  • 6. Current Status • Supposed to allow independent release cycles ▫ kind of successful • Has less oversight into code quality ▫ pecl qa? ▫ needs someone to be “secretary” and “organizer” ▫ always need people to test code, write tests, triage bugs, write docs • Still has “siberia” modules
  • 7. Future Plans and Ideas • Real Siberia ▫ delete badly licensed extensions ▫ delete AWOL extensions ▫ move dead (superseded, library no longer exists) • Better Windows Support ▫ Release builds ▫ CVS snapshot builds • Recruit Developers and Helpers ▫ This talk ▫ Marketing – blog posts, podcasts, word of mouth • Pyrus and PEAR installer fixes • Automated testing for stuff in CVS
  • 8. PECL and PHP Core • Core -> PECL ▫ no, not to die ▫ few users ▫ not as widely useful features ▫ lack of maintainers ▫ examples: ncurses, dbase • PECL -> Core ▫ widely useful features ▫ lots of users ▫ good maintenance ▫ examples: phar, zip, json
  • 9. How to join PECL • Subscribe to the pecl.dev mailing list ▫ pecl-dev-subscribe@lists.php.net • Introduce yourself, if you have a project idea introduce it and show some code, meet people, ask questions • #php.pecl IRC channel at the efnet.org • To learn how to write extensions – go to Sara’s talk at 4pm today!
  • 10. Using PECL • pecl install {$extname} ▫ isn’t always available ▫ doesn’t work correctly on windows ▫ downloads, configures, compiles for you • compile by hand ▫ always works ▫ requires some knowledge • use binaries ▫ windows – download, put in /ext directory, enable in php.ini ▫ third party packages for pecl (rpm, .deb, whatever)
  • 11. Let’s pick a peck of pickled PECLs
  • 12. Types of Extensions • Wrap a C Library • Provide functionality in C code instead of PHP • Alter engine functionality • Provide debugging features • Allow embedded languages
  • 13. Why would you want a C extension? • Functionality • Speed • Do the impossible
  • 14. Picks Criteria • Popularity is hard to judge, although some try ▫ http://www.nexen.net/articles/dossier/18038- base_configuration_for_php_5.2.5.php • Usefulness is hard to judge, people have different needs • What I think you might find useful • Extensions I think are cool
  • 15. Opcode Caching Caches the compiled bytecode of PHP scripts to avoid the overhead of parsing and compiling source code on each request (some or all of which may never even be executed) For best performance, caching is to shared memory with direct execution from the shared memory and the minimum of memory copying at runtime.
  • 16. APC - Alternative PHP Cache • Maintainer: ▫ George Schlossnagle ▫ Daniel Cowgill ▫ Rasmus Lerdorf ▫ Gopal Vijayaraghavan • Type: Engine Changes • Release: 3.0.19 stable 2008-05-15 • Description: APC is a free, open, and robust framework for caching and optimizing PHP intermediate code.
  • 17. Using APC APC is both an opcode cache and an in memory <?php $bar = 'BAR'; cache to store data apc_add('foo', $bar); var_dump(apc_fetch('foo')); in your scripts echo quot;nquot;; $bar = 'NEVER GETS SET'; It can also be used for apc_add('foo', $bar); file progress var_dump(apc_fetch('foo')); echo quot;nquot;; uploads $constants = array( 'ONE' => 1, 'TWO' => 2, 'THREE' => 3, ); apc_define_constants('numbers', $constants); echo ONE, TWO, THREE; echo quot;nquot;; $bar = 'BAR'; apc_store('foo', $bar); string(3) quot;BARquot; apc_delete('foo'); // this is obviously useless in this form string(3) quot;BARquot; $bar = 'BAR'; 123 apc_store('foo', $bar); var_dump(apc_fetch('foo')); string(3) quot;BARquot;
  • 18. Memcache • Maintainer: ▫ Antony Dovgal ▫ Mikael Johansson • Type: Internal code (doesn’t use C client lib) • Release: 2.2.3 stable 2008-02-05 3.0.1 beta 2008-02-05 • Description: Memcached is a caching daemon designed especially for dynamic web applications to decrease database load by storing objects in memory. This extension allows you to work with memcached through handy OO and procedural interfaces.
  • 19. Using Memcache http://www.danga.com/me mcached/ <?php For more information $memcache = new Memcache; about memcached $memcache- >connect('localhost', 11211) or die (quot;Could not connectquot;); $version = $memcache->getVersion(); memcached is a high- echo quot;Server's version: quot;.$version.quot;<br/>nquot;; performance, distributed $tmp_object = new stdClass; memory object caching $tmp_object->str_attr = 'test'; system, generic in $tmp_object->int_attr = 123; nature, but intended for $memcache- use in speeding up >set('key', $tmp_object, false, 10) or die (quot;Failed to save data dynamic web at the serverquot;); echo quot;Store data in the cache (data will expire in 10 second applications by s)<br/>nquot;; alleviating database load. $get_result = $memcache->get('key'); echo quot;Data from the cache:<br/>nquot;; var_dump($get_result);
  • 20. Image Manipulation • gd (php core) • imagick • cairo (new, gsoc 2008, not yet released) • cairo_wrapper • FreeImage (imagemagick library fork) • imlib2
  • 21. Imagick • Maintainer: ▫ Mikko Koppanen ▫ Scott MacVicar • Type: Library Wrapper • Library: Imagick http://www.imagemagick.org/script/index.php • Release: 2.2.0 stable 2008-07-09 2.2.1RC2 beta 2008-09-05 • Description: Imagick is a native php extension to create and modify images using the ImageMagick API. This extension requires ImageMagick version 6.2.4+ and PHP 5.1.3+.
  • 22. Using Imagick <?php $canvas->newImage(350, 70, quot;whitequot;); Create a new imagick object */ $im = new Imagick(); /* Draw the ImagickDraw on to the canvas */ $canvas->drawImage($draw); /* Create new image. This will be used as fill pattern */ $im->newPseudoImage(50, 50, quot;gradient:red-blackquot;); /* 1px black border around the image */ $canvas->borderImage('black', 1, 1); /* Create imagickdraw object */ $draw = new ImagickDraw(); /* Set the format to PNG */ $canvas->setImageFormat('png'); /* Start a new pattern called quot;gradientquot; */ $draw->pushPattern('gradient', 0, 0, 50, 50); /* Output the image */ header(quot;Content-Type: image/pngquot;); /* Composite the gradient on the pattern */ echo $canvas; $draw->composite(Imagick::COMPOSITE_OVER, 0, 0, 50, 50, $im); /* Close the pattern */ $draw->popPattern(); /* Use the pattern called quot;gradientquot; as the fill */ $draw->setFillPatternURL('#gradient'); /* Set font size to 52 */ $draw->setFontSize(52); /* Annotate some text */ $draw->annotation(20, 50, quot;Hello World!quot;); /* Create a new canvas object and a white image */ $canvas = new Imagick();
  • 23. HTTP Related • uploadprogress • pecl_http (so named to avoid classes with PEAR http)
  • 24. Http • Maintainer: Michael Wallner • Type: Added Functionality • Release: 1.6.1 stable 2008-07-23 • Description: This extension eases handling of HTTP urls, dates, redirects, headers and messages, provides means for negotiation of clients preferred language and charset, as well as a convenient way to send any arbitrary data with caching and resuming capabilities. It provides powerful request functionality, if built with CURL support. Parallel requests are available for PHP 5 and greater.
  • 25. Using HTTP <?php try { $charsets = array( $pool = new HttpRequestPool( 'iso-8859-1', // default new HttpRequest('http://www.google.com/', HttpRequest::M 'iso-8859-2', ETH_HEAD), 'iso-8859-15', new HttpRequest('http://www.php.net/', HttpRequest::METH 'utf-8' _HEAD) ); ); $pool->send(); $pref = http_negotiate_charset($charsets, $result); foreach($pool as $request) { printf(quot;%s is %s (%d)nquot;, if (strcmp($pref, 'iso-8859-1')) { $request->getUrl(), iconv_set_encoding('internal_encoding', 'iso-8859-1'); $request->getResponseCode() ? 'alive' : 'not alive', iconv_set_encoding('output_encoding', $pref); $request->getResponseCode() ob_start('ob_iconv_handler'); ); } } } catch (HttpException $e) { print_r($result); echo $e; } $string = quot;quot;. quot;05rnquot;. quot;this rnquot;. quot;07rnquot;. quot;string rnquot;. quot;12rnquot;. quot;is chunked encodedrnquot;. quot;01nrnquot;. quot;00quot;; echo http_chunked_decode($string);
  • 26. Upload Progress • Maintainer: Christian Stocker Ben Ramsey • Type: Added Functionality • Release: 0.9.1 beta 2008-08-25 • Description: An extension to track progress of a file upload.
  • 27. About UploadProgress prototypes string uploadprogress_get_contents(string identifier, string fieldname[, int maxlen]) array uploadprogress_get_info(string identifier) array returned Array { [identifier] => string, [identifier_tmp] => string, [upload_id] => string, [data_filename] => temp data file, [fieldname] => upload field name, [filename] => filename of uploaded file, [time_start] => int, [time_last] => int, [speed_average] => int, [speed_last] => int, [bytes_uploaded] => int, [bytes_total] => int, [files_uploaded] => int, [est_sec] => int } This gives a lot more information then, for example, APC's upload progress implementation
  • 28. PDF Madness • clibpdf (commercial – discontinued) • pdflib (commercial) • panda (Panda C library) • haru (libharu – winner!) • ps (postscript – if you need it)
  • 29. Haru • Maintainer: Antony Dovgal • Type: C library wrapper • Lib: http://libharu.org/ • Release: 0.0.1 beta 2007-03-26 • Description: PHP interface to Haru Free PDF Library for creating PDF documents
  • 30. Using Haru <?php $doc = new HaruDoc; $doc->setPageMode(HaruDoc::PAGE_MODE_USE_THUMBS); /* show thumbnails */ $page = $doc->addPage(); /* add page to the document */ $page- >setSize(HaruPage::SIZE_A4, HaruPage::LANDSCAPE); /* set the page to use A4 landscape format */ $courier = $doc->getFont(quot;Courier-Boldquot;); /* we'll use the bundled font a few lines below */ From php.net – $page->setRGBStroke(0, 0, 0); /* set colors */ should create $page->setRGBFill(0.7, 0.8, 0.9); $page->rectangle(150, 150, 550, 250); /* draw a rectangle */ a pdf with a $page->fillStroke(); /* fill and stroke it */ light-blue $page->setDash(array(3, 3), 0); /* set dash style for lines at this page */ rectangle and $page->setFontAndSize($courier, 60); /* set font and size */ white quot;Hello $page->setRGBStroke(0.5, 0.5, 0.1); /* set line color */ $page->setRGBFill(1, 1, 1); /* set filling color */ World!quot; on it $page->setTextRenderingMode(HaruPage::FILL_THEN_STROKE); /* fill and stroke text */ /* print the text */ $page->beginText(); $page->textOut(210, 270, quot;Hello World!quot;); $page->endText(); $doc->save(quot;/tmp/test.pdfquot;); /* save the document into a file */
  • 31. Amfext • Maintainer: Emanuele Ruffaldi • Type:Added Functionality • Release: 0.9.2 beta 2008-07-23 • Description: Allows to encode and decode PHP data in ActionScript Message Format (AMF) version 0 and 3
  • 32. Using AMFEXT <?php $r = amf_encode(quot;hello worldquot;,AMF_AS_STRING_BUILDER); // ask to return a S B echo(quot;returned type: quot; . $r . quot;nquot;); echo(quot;returned length: quot; . amf_sb_length($r) . quot;nquot;); $sb1 = amf_sb_new(); amf_sb_append($sb1,quot;prefixquot;); amf_encode(quot;hello worldquot;,0,quot;quot;,$sb1); // store the result into the provided SB echo(quot;returned type: quot; . $sb1 . quot;nquot;); echo(quot;returned length: quot; . amf_sb_length($sb1) . quot;nquot;); var_dump($contents);
  • 33. Version Control • cvsclient (not complete but works) • perforce • svn
  • 34. SVN • Maintainer: Alan Knowles Wez Furlong Scott MacVicar • Type: Library Wrapper • Library: libsvn • Release: 0.4.1 beta 2008-06-24 • Description: Bindings for the Subversion revision control system, providing a method for manipulating a working copy or repository with PHP
  • 35. Using SVN <?php // svn_fs_is_file call: // From user notes on PHP.net - print_r(svn_fs_is_file($fs_rev_handle, '/a-file.txt')); manipulating an actual repository // Get a handle to the on- // doing a diff disk repository. Note that this list($diff, $errors) = svn_diff( // is NOT a checked out project, but the a 'http://www.example.com/svnroot/trunk/foo', SVN_REV ctual svn repository! ISION_HEAD, $repos_handle = svn_repos_open('/var/lib/svn'); 'http://www.example.com/svnroot/branches/dev/foo', SV $fs_handle = svn_repos_fs($repos_handle); N_REVISION_HEAD ); // Now we need to open a revision because that's what the if (!$diff) exit; // svn_fs_* methods need. You'll probably $contents = ''; want the latest while (!feof($diff)) { // revision and we have a helper method fo $contents .= fread($diff, 8192); r that. } $youngest_rev = svn_fs_youngest_rev($fs_handle); fclose($diff); $fs_rev_handle = svn_fs_revision_root($fs_handle, $youngest fclose($errors); _rev); var_dump($contents); // Now we can actually start doing stuff, for example the Index: http://www.example.com/svnroot/trunk/foo =============================================== ==================== --- http://www.example.com/svnroot/trunk/foo (.../foo) (revision 23) +++ http://www.example.com/svnroot/branches/dev/foo (.../foo) (revision 27) // further diff output
  • 36. Database Support • pdo_informix • pdo_ibm • paradox • odbtp • ingres • isis • notes • pdo_user – wait…what’s this?
  • 37. PDO_USER • Maintainer: Sara Golemon Ben Ramsey • Type: Hybrid Craziness • Release: 0.3.0 beta 2007-10-30 • Description: This extension provides a Userspace interface for PDO drivers
  • 38. Using PDO_USER • Defines two interfaces that your new PDO classes should implement, PDO_User_Driver and PDO_User_Statement • It also defines a Class called PDO_User with some static helper methods, including a dsn parser and some sqlparser functions • Documentation is available at http://cvs.php.net/viewvc.cgi/pecl/pdo_user/README.OBJECTS?view=co • It does NOT have hooks for the param binding data, so you can’t, for example, use mysqli_prepare_statement since you can’t bind the parameters properly • Would be interesting to see this get some use and maybe even get into core – imagine being able to write your db access in pdo even when a native pdo driver doesn’t exist
  • 39. Internationalization • translit • intl • fribidi • idn
  • 40. Translit • Maintainer: Derick Rethans • Type: Provides Functionality • Release: 0.6.0 beta 2008-04-01 • Homepage: http://derickrethans.nl/translit.php • Description: This extension allows you to transliterate text in non-latin characters (such as Chinese, Cyrillic, Greek etc) to latin characters. Besides the transliteration the extension also contains filters to upper- and lowercase latin, cyrillic and greek, and perform special forms of transliteration such as converting ligatures such as the Norwegian quot;æquot; to quot;aequot; and normalizing punctuation and spacing.
  • 41. Using Translit <?php $string = file_get_contents('test-text.utf8'); $res = transliterate($string, array('han_transliterate', 'diacritical_remove'), 'utf-8', 'utf-8'); echo $res; Input ĀāĂ㥹ĆćĂ㥹ĈĉĆćĈĊĆćĈĉĊċĉĊċČČčĞğ 大平矿难死者增至66人 郑煤所属煤矿全停产 Output AaAaAaCcCcCcCcDdDdEeEeEeEeEeGgGg dapingkuangnansǐzhezengzhi66ren zhengmeisuǒshǔmeikuangquantingchǎn
  • 42. Text • bbcode • colorer • doublemetaphone • enchant • namazu • stem • xdiff
  • 43. bbcode • Maintainer: Xavier De Cock • Type: Provides Functionality • Release: 1.0.2 stable 2008-08-18 • Description: This is a quick and efficient BBCode Parsing Library. It provides various tag types, high speed tree based parsing, callback system, tag position restriction, Smiley Handling, Subparsing It will force closing BBCode tags in the good order, and closing terminating tags at the end of the string this is in order to ensure HTML Validity in all case.
  • 44. Using bbcode <?php /* * Preparing RuleSet */ $arrayBBCode=array( 'b'=> array('type'=>BBCODE_TYPE_NOARG, 'open_tag'=>'<b>', 'close_tag'=>'</b>'), <i> Parser <b> Auto Correction 'u'=> array('type'=>BBCODE_TYPE_NOARG, 'open_tag'=>'<u>', 'close_tag'=>'</u>'), </b></i> at work <i> Parser 'i'=> array('type'=>BBCODE_TYPE_NOARG, 'open_tag'=>'<i>', 'close_tag'=>'</i>'), <b> Auto Correction ); </b></i><b> at work </b> /* * Paired incorrectly nested BBCode <i> Parser [b] Auto */ $text=quot;[i] Parser [b] Auto Correction [/i] at work [/b]nquot;; Correction </i> at work <i> $BBHandler=bbcode_create($arrayBBCode); echo bbcode_parse($BBHandler,$text); Parser <b> Auto Correction // Enabling reopening of automaticaly closed elements </b></i><b> at work </b> bbcode_set_flags($BBHandler,BBCODE_CORRECT_REOPEN_TAGS, BBCODE_SET_FLAGS_SET); echo bbcode_parse($BBHandler,$text); /* * Unpaired incorrectly nested BBCode */ $text=quot;[i] Parser [b] Auto Correction [/i] at worknquot;; echo bbcode_parse($BBHandler,$text); // Enabling automatic close of pending tags bbcode_set_flags($BBHandler, BBCODE_CORRECT_REOPEN_TAGS|BBCO DE_AUTO_CORRECT, BBCODE_SET_FLAGS_SET); echo bbcode_parse($BBHandler,$text);
  • 45. Search • clucene • mnogosearch • swish • sphinx
  • 46. Sphinx • Maintainer: Antony Dovgal • Type: Library Wrapper • Library: libsphinx http://www.sphinxsearch.com/ • Release: 0.2.0 beta 2008-07-31 • Description: This extension provides bindings for libsphinxclient, client library for Sphinx
  • 47. Using Sphinx array(10) { [quot;errorquot;]=> string(0) quot;quot; [quot;warningquot;]=> string(0) quot;quot; [quot;statusquot;]=> <?php int(0) [quot;fieldsquot;]=> array(3) { [0]=> string(7) quot;subjectquot; $s = new SphinxClient; [1]=> string(4) quot;bodyquot; $s->setServer(quot;localhostquot;, 6712); [2]=> string(6) quot;authorquot; } $s->setMatchMode(SPH_MATCH_ANY); [quot;attrsquot;]=> array(0) { $s->setMaxQueryTime(3); } [quot;matchesquot;]=> array(1) { [3]=> array(2) { $result = $s->query(quot;testquot;); [quot;weightquot;]=> int(1) [quot;attrsquot;]=> array(0) { } var_dump($result); } } [quot;totalquot;]=> int(1) [quot;total_foundquot;]=> int(1) [quot;timequot;]=> float(0) [quot;wordsquot;]=> array(1) { [quot;toquot;]=> array(2) { [quot;docsquot;]=> int(1) [quot;hitsquot;]=> int(1) } } }
  • 48. PHP – do bad things • runkit • funcall • intercept • operator
  • 49. Runkit • Maintainer: Sara Golemon • Type: Engine Manipulation • Release: 0.9 beta 2006-06-06 • Description: Replace, rename, and remove user defined functions and classes. Define customized superglobal variables for general purpose use. Execute code in restricted environment (sandboxing)
  • 50. Using Runkit <?php runkit_function_add('testme','$a,$b','echo quot;The value of a is $anquot;; echo quot;The value of b is $bnquot;;'); testme(1,2); function original() { echo quot;In a functionnquot;; } runkit_function_copy('original','duplicate'); original(); duplicate(); The value of a is 1 function testme() { echo quot;Original Testme Implementationnquot;; The value of b is 2 } testme(); runkit_function_redefine('testme','','echo quot;New Testme Implementationnquot;;'); testme(); In a function class Example { function foo() { In a function echo quot;foo!nquot;; } } Original Testme Implementation // create an Example object $e = new Example(); New Testme Implementation // Add a new public method runkit_method_add( 'Example', 16 'add', '$num1, $num2', 'return $num1 + $num2;', RUNKIT_ACC_PUBLIC ); // add 12 + 4 echo $e->add(12, 4);
  • 51. Funcall • Maintainer: Surf Chen • Type: Engine Manipulation • Release: 0.2.1 stable 2008-04-07 • Site: http://code.google.com/p/funcall/ • Description: Call callbacks before or after specified functions/methods being called
  • 52. Using Funcall <?php var_dump($result); function my_func($arg1,$arg2) { echo 'step 003 (cost:',$process_time usleep(20000); ,quot;)nquot;; echo quot;step 002nquot;; } return $arg1.$arg2; } fc_add_pre('my_func','pre_cb'); class my_class { fc_add_post('my_func','post_cb'); function f1() { my_func('php','c'); return true; } fc_add_post('trim','post_cb'); } echo trim(quot;abcnquot;); function pre_cb($args) { var_dump($args); fc_add_pre('my_class::f1','pre_cb'); echo quot;step 001nquot;; fc_add_post('my_class::f1','post_cb'); } $my_class=new my_class; function post_cb($args,$result,$process $my_class->f1(); _time) { var_dump($args); var_dump(fc_list());
  • 53. Intercept • Maintainer: Gabriel Ricard • Type: Engine Manipulation • Release: 0.3.0 alpha 2005-05-28 • Description: Allows the user to have a user- space function called when the specified function or method is called
  • 54. Using Intercept <?php function myfunc() { echo quot;this is my functionquot;; before myfunc() } this is my function after myfunc() function pre_myfunc() { echo quot;before myfunc()quot;; } function post_myfunc() { echo quot;after myfunc()quot;; } intercept_add('myfunc', 'pre_myfunc', PRE_INTERCEPT); intercept_add('myfunc', 'post_myfunc', POST_INTERCEPT); myfunc();
  • 55. Operator • Maintainer: Sara Golemon • Type: Engine Manipulation • Release: 0.3 beta 2006-02-08 • Description: Operator overloading for: +, -, *, /, %, <<, >>, ., |, &, ^, ~, !, ++, --, +=, -=, *=, /=, %=, <<=, >>=, .=, |=, &=, ^=, ~=, ==, !=, ===, !==, <, and <= operators. Conditional support for > and >= available with application of a patch.
  • 56. Using Operator <?php } class foo { private $value; function __construct($init) { $this->value = $init; function __is_identical($val) { } return $this->value === $val; } } $c = new foo(5); bool(true) function __is_not_identical($val) { return $this->value !== $val; var_dump($c === 5); bool(false) } var_dump($c === '5'); bool(false) var_dump($c !== 5); function __is_equal($val) { var_dump($c !== '5'); bool(true) return $this->value == $val; var_dump($c == 5); bool(true) } var_dump($c == '5'); bool(true) var_dump($c == 6); function __is_not_equal($val) { var_dump($c != 5); bool(false) return $this->value != $val; var_dump($c != '5'); bool(false) } var_dump($c != 6); var_dump($c < 5); bool(false) function __is_smaller($val) { var_dump($c < 6); bool(true) return $this->value < $val; var_dump($c <= 5); bool(false) } var_dump($c <= 4); bool(true) function __is_smaller_or_equal($val bool(true) ){ return $this->value <= $val; bool(false)
  • 58. spl_types • Maintainer: Marcus Börger David Coallier • Type: Additional Functionality • Release: 0.3.0 stable 2008-01-13 • Description: SPL Types is a collection of special typehandling classes
  • 59. Using spl_types <?php class EnumOne extends SplEnum { $int = new SplInt(94); const __default = 1; } try { $int = 'Try to cast a string value for fun'; class EnumTwo extends SplEnum { } catch (UnexpectedValueException $uve) const __default = 2; { } echo $uve->getMessage() . PHP_EOL; } class EnumThree extends SplEnum { const __default = 3; echo $int; // Outputs 94 } $float = new SplFloat(3.154); $enumOne = new EnumOne(); $newFloat = new SplFloat(3); $enumTwo = new EnumTwo(); $enumThree = new EnumThree(); try { $float = 'Try to cast a string value for fun'; } catch (UnexpectedValueException $uve) echo $enumOne; // outputs 1 { echo $enumTwo; // outputs 2 echo $uve->getMessage() . PHP_EOL; echo $enumThree; // outputs 3 } ($c <= 4); echo $float; // Outputs 3.154 echo $newFloat; // Outputs 3
  • 60. params • Maintainer: Sara Golemon • Type: Additional Functionality • Release: 1.0 stable 2007-11-13 • Description: Userspace equivalent of zend_parse_parameters()
  • 61. Using params Params Extension ---------------- <?php function example() { Array params_parse(string $format, ...); list($foo, $bar, $baz) = params_parse(quot;slrquot;); // $foo will be a string $format is a type specifier string containin one or more of the following type // $bar will be a long (integer) specifiers: // $baz will be a resource } b The parameter will be converted to boolean and added to the output stack function ex2() { l The parameter will be converted to long (integer) and added to list($foo, $bar, $baz) = params_parse(quot;O|lbquot;, quot;stdClassquot;); the output stack // $foo will be an object of type stdClass d The parameter will be converted to double (float) and added to // $bar will be a long (integer), with a default va the output stack lue of 0 s The parameter will be converted to string and added to the output // $baz will be a double (float), with a default va stack lue of 0.0 a The parameter will be converted to array and added to the output } stack o The parameter will be converted to an object and added to the function ex3() { output stack list($foo) = params_parse(quot;Oquot;, array(quot;Aquot;, quot;Bquot;, quot;Cquot;)); O The parameter must be an object of the type(s) specified by the // $foo will be an object of type A, B, or C next argument to params_parse() } r The parameter must be a resource (of any type) R The parameter must be a resource of the type(s) specified by the function ex4() { next argument to params_parse() list($foo) = params_parse(quot;Oquot;, true); z The parameter will be added to the output stack regardless of // $foo will be an object of any type, but must be passed as an object (will not type be converted) * The output stack will be populated with an array containing a } variable number of arguments as passed + Same as '*' but at least one var-arg is required function ex5() { list($fp, $obj) = params_parse(quot;ROquot;, quot;streamquot;, quot;stdClassquot;); A single pipe '|' may be used in the format specifier to split required arguments // $fp will be a stream (file) resource from optional arguments. // $obj will be an object of type stdClass } If params_parse() is unable to return the requested types (because of 'r', 'R', or 'O' type checking failures or insufficient args), it will return false.
  • 62. Debugging Tools • xdebug • inclued (yes that’s spelled right) • apd
  • 63. XDebug • Maintainer: Derick Rethans • Type: Debugging • Release: 2.0.3 stable 2008-04-09 • Description: The Xdebug extension helps you debugging your script by providing a lot of valuable debug information. The debug information that Xdebug can provide includes the following: * stack and function traces in error messages with: o full parameter display for user defined functions o function name, file name and line indications o support for member functions * memory allocation * protection for infinite recursions Xdebug also provides: * profiling information for PHP scripts * code coverage analysis * capabilities to debug your scripts interactively with a debug client
  • 64. Using Xdebug Xdebug has many features 1. Displays stack traces on error 2. Maximum nesting level protection 3. Time tracking 4. Pretty variable dumping (var_dump and friends) 5. Stack traces 6. Function traces 7. Code Coverage 8. Profiling 9. Remote Debugging
  • 65. SSH2 • Maintainer: Sara Golemon • Type: Library Wrapper • Library: http://www.libssh2.org • Release: 0.10 beta 2005-11-01 • Provides bindings to the functions of libssh2 which implements the SSH2 protocol. libssh2 is available from http://www.sourceforge.net/projects/libssh2
  • 66. Using SSH2 <?php $connection = ssh2_connect('shell.example.com', 22); ssh2_auth_password($connection, 'username', 'password'); $sftp = ssh2_sftp($connection); $stream = fopen(quot;ssh2.sftp://$sftp/path/to/filequot;, 'r'); $connection = ssh2_connect('shell.example.com', 22); ssh2_auth_password($connection, 'username', 'password'); $stream = ssh2_shell($connection, 'vt102', null, 80, 24, SSH2 _TERM_UNIT_CHARS);
  • 67. Docblock • Maintainer: Greg Beaver • Type: Additional Functionality • Release: 0.2.0 alpha 2006-06-27 • Description This extension is like the tokenizer extension for PHP. It takes a document comment (docblock) like this one: /** * information {@inlinetag} * @tags */ and parses it into tokens. The primary function is docblock_tokenize(), which accepts a string, and returns an array of arrays of array(TOKEN, quot;tokenquot;). TOKEN is one of DOCBLOCK_* constants. docblock_tokenize() has an optional second bool parameter that determine whether to output non-essential tokens like the /** * stuff. docblock_token_name() takes a DOCBLOCK_* constant and returns its
  • 68. Using DocBlock <?php docblock_tokenize( quot;/** * hi there * @author Greg Beaver <cellog@php.net> * @version 1.0.0 */quot;); quot;DOCBLOCK_COMMENTSTARTquot; quot; Greg Beaver <cellog@php.net>quot; quot;/**quot; quot;DOCBLOCK_NEWLINEquot; quot;DOCBLOCK_NEWLINEquot; quot; quot;DOCBLOCK_TEXTquot; quot; quot;hi therequot; quot;DOCBLOCK_ASTERISKquot; quot;DOCBLOCK_NEWLINEquot; quot;*quot; quot; quot;DOCBLOCK_WHITESPACEquot; quot; quot;quot; quot;DOCBLOCK_ASTERISKquot; quot;DOCBLOCK_TAGquot; quot;*quot; quot;@versionquot; quot;DOCBLOCK_WHITESPACEquot; quot;DOCBLOCK_TEXTquot; quot;quot; quot; 1.0.0quot; quot;DOCBLOCK_TAGquot; quot;DOCBLOCK_COMMENTENDquot; quot;@authorquot; quot;*/quot; quot;DOCBLOCK_TEXTquot;
  • 69. Language Embedding • java • lua • perl • Python
  • 70. Embedded Python • Maintainer: Jon Parise • Type: Language Embedded • Release: 0.8.0 alpha 2008-02-17 • Description: This extension allows the Python interpreter to be embedded inside of PHP, allowing for the instantiate and manipulation of Python objects from within PHP
  • 71. Using Embedded Python <?php $a = quot;testquot;; $b = true; test 1 50 60.4 $c = 50; test 2.208 test $d = 60.4; $code = <<<EOD import php a = php.var('a') http://www.csh.rit.edu/~jon/projects/pip/ b = php.var('b') More information on how to use it c = php.var('c') d = php.var('d') print a, b, c, d print a, d / c + b, a EOD; py_eval($code);
  • 72. My “Please adopt me” wishlist • preprocessor • intercept/funcall with full features • threads
  • 73. Extension do exist outside of PECL Phurple libpurple bindings http://sourceforge.net/projects/phurple/ Xcache opcode cache http://xcache.lighttpd.net/ php-gtk gui http://gtk.php.net php-qt gui http://php-qt.org/ ioncube encoder and opcode cache http://www.ioncube.com/ zend encoder and opcode cache http://zend.com IRCG xml streaming http://schumann.cx/ircg/index.php midgard cms functionality http://www.midgard-project.org suhosin security http://www.hardened-php.net/suhosin/ blitz templating http://alexeyrybak.com/blitz/blitz_en.html dbg debugging http://dd.cron.ru/dbg/ eaccelerator opcode cache http://eaccelerator.net/ http://www.microsoft.com/sql/technologies/ph sqlsrv db extension p/default.mspx ffmpeg-php Wrapper for ffmpeg lib http://ffmpeg-php.sourceforge.net/
  • 74. Resources • Slides • http://elizabethmariesmith.com/slides/pecl-picks.pdf • PECL • http://pecl.php.net • http://news.php.net/article.php?group=php.pecl.dev&article =5 • http://marc.info/?l=pecl-dev • Me • http://elizabethmariesmith.com • auroraeosrose@php.net • Information from http://php.net , http://cvs.php.net and http://pecl.php.net – documentation, extension examples, and occasionally phpt tests - thanks to all who work on PHP THANKS