SlideShare a Scribd company logo
1 of 32
John’s Top PECL Picks John Coggeshall
Welcome to the session ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],May 28, 2009 #
What is PECL? ,[object Object],[object Object],[object Object],[object Object]
What is PECL? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Using PECL extensions ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Compiling PECL from source ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Compiling PECL from source ,[object Object],$ tar –zxvf mypeclext.tgz $ cd mypeclext/ $ phpize $ ./configure  $ make $ make install
What about Windows? ,[object Object],[object Object],[object Object],[object Object],[object Object]
My Favorite PECL Extensions
About my picks ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Fileinfo Extension ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Fileinfo Extension ,[object Object],$info = new finfo(FILEINFO_MIME); echo “The Mime Type is: “ . $info->file(‘/tmp/myfile.mpg’); ,[object Object],$info = new finfo(FILEINFO_MIME, “/path/to/file/magic”);
Phar Extension ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Creating Phars ,[object Object],[object Object],[object Object],file_put_contents(‘phar:///full/path/to/application.phar/file.php’, ‘<?php print “Hello World!”; ?>’); ,[object Object],$phar = new Phar(‘/full/path/to/application.phar’, 0,  ‘ application.phar’); $phar[‘file.php’] = ‘<?php print “Hello World!”; ?>’;
Creating Phars ,[object Object],[object Object],$phar[‘realbigfile.data’]->setCompressedGZ(); ,[object Object],$phar[‘images/myimage.png’]->setMetaData(array(‘mime’ => ‘image/png’)); $phar->setMetadata(array(‘bootstrap’ => ‘index.php’));
Using Phar files ,[object Object],[object Object],Include_once ‘library.phar’; ,[object Object],Include_once ‘phar://library.phar/myfiles/file.php’; ,[object Object]
Using Phar files ,[object Object],<?php $phar = new Phar(‘/path/to/application.phar’, 0, ‘myapp.phar’); // Get a PharFileInfo instance // uses phar://myapp.phar/file.php $phar_info = $phar[‘file.php’]; // Create a new file (or overwrite) called file.php with the contents $contents $phar[‘file.php’] = $contents; // Check to see if a file exists within a phar If(isset($phar[‘file.php’]))… // Erase a file from the phar unset($phar[‘file.php’]);
Using Phar files ,[object Object],$phar->setMetadata(array(‘bootstrap’ => ‘index.php’)); [/home/john]$ php application.phar <?php   /* index.php */ $p = new Phar(__FILE__);   $m = $p->getMetaData();   require &quot;phar://&quot; . __FILE__ . &quot;/&quot; . $m[&quot;bootstrap&quot;]; __HALT_COMPILER();  ?>
XDiff ,[object Object],[object Object],[object Object],[object Object],[object Object]
Using XDiff ,[object Object],<?php xdiff_file_diff(“input1.txt”, “input2.txt”, “output.txt”); ,[object Object],@@ -1,1 +1,1 @@ -Hello +Hello, World! ,[object Object]
Patching using XDiff ,[object Object],@@ -1,1 +1,1 @@ -Hello +Hello, World! <?php $patch = file_get_contents(‘mypatch.diff’); $original = file_get_contents(‘myfile.txt’); $patched = xdiff_string_patch($original, $patch); file_put_contents(‘myfilepatched.txt’, $patched);
More XDiff Goodies ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Zip extension ,[object Object],[object Object],[object Object],[object Object],[object Object]
Using Zip: Creating Archives ,[object Object],[object Object],[object Object],<?php   $zip = new ZipArchive(); $zip->open(‘myarchive.zip’, ZIPARCHIVE::CREATE); $zip->addFile(‘/path/to/myfile.dat’, ‘newname.dat’); $zip->addFromString(‘myfile.txt’, ‘This is my file…’); print “Total files: “ . $zip->numFiles; $zip->close(); ?>
Using Zip: Reading Archives ,[object Object],[object Object],[object Object],[object Object],$uncompressed = file_get_contents(‘zip://myarchive.zip#myfile.txt’);
Using Zip: Reading Archives ,[object Object],<?php $zip = new ZipArchive(); $zip->open(‘myarchive.zip’); $zip->extractTo(‘mydirectory’); $zip->close(); <?php $zip = new ZipArchive(); $zip->open(‘myarchive.zip’); $zip->extractTo(‘.’, array(‘file1.txt’, ‘file2.txt’)); $zip->close();
SSH2 Extension ,[object Object],[object Object],[object Object],[object Object]
Using SSH2 ,[object Object],<?php   $connect = ssh2_connect(‘coggeshall.org’, 22); ssh2_auth_password($connect, ‘username’, ‘password’); $result = ssh2_exec($connect, ‘/usr/local/bin/php –i’); while(!feof($result)) { print fgets($result, 4096); } ?> ,[object Object]
Using SSH2: Secure Copy ,[object Object],[object Object],<?php $connect = ssh2_connect(‘coggeshall.org’, 22); ssh2_auth_password($connect, ‘username’, ‘password’); // Sending a file ssh2_scp_send($connect, ‘/myfile.txt’, ‘/remotefile.txt’, 0755); // Copying a file from a remote location ssh2_scp_recv($connect, ‘/remotefile.txt’, ‘localfile.txt’); ?>
Some final thoughts ,[object Object],[object Object],[object Object],[object Object],[object Object]
Tips on determining readiness  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Questions? Thank you!

More Related Content

What's hot

Ruby Projects and Libraries
Ruby Projects and LibrariesRuby Projects and Libraries
Ruby Projects and Libraries
Vorleak Chy
 

What's hot (18)

Phing
PhingPhing
Phing
 
Writing and using php streams and sockets tek11
Writing and using php streams and sockets   tek11Writing and using php streams and sockets   tek11
Writing and using php streams and sockets tek11
 
Final opensource record 2019
Final opensource record 2019Final opensource record 2019
Final opensource record 2019
 
Writing and using php streams and sockets
Writing and using php streams and socketsWriting and using php streams and sockets
Writing and using php streams and sockets
 
PyCon Taiwan 2013 Tutorial
PyCon Taiwan 2013 TutorialPyCon Taiwan 2013 Tutorial
PyCon Taiwan 2013 Tutorial
 
Composer the right way - SunshinePHP
Composer the right way - SunshinePHPComposer the right way - SunshinePHP
Composer the right way - SunshinePHP
 
Ruby Projects and Libraries
Ruby Projects and LibrariesRuby Projects and Libraries
Ruby Projects and Libraries
 
Resource-Oriented Web Services
Resource-Oriented Web ServicesResource-Oriented Web Services
Resource-Oriented Web Services
 
Introduction to php web programming - get and post
Introduction to php  web programming - get and postIntroduction to php  web programming - get and post
Introduction to php web programming - get and post
 
PECL Picks - Extensions to make your life better
PECL Picks - Extensions to make your life betterPECL Picks - Extensions to make your life better
PECL Picks - Extensions to make your life better
 
Putting Phing to Work for You
Putting Phing to Work for YouPutting Phing to Work for You
Putting Phing to Work for You
 
PHP Presentation
PHP PresentationPHP Presentation
PHP Presentation
 
Deploying PHP applications with Phing
Deploying PHP applications with PhingDeploying PHP applications with Phing
Deploying PHP applications with Phing
 
Zend Framework 1.8 workshop
Zend Framework 1.8 workshopZend Framework 1.8 workshop
Zend Framework 1.8 workshop
 
Day1
Day1Day1
Day1
 
PHPUnit in 4 parts - ConFoo 2019
PHPUnit in 4 parts - ConFoo 2019PHPUnit in 4 parts - ConFoo 2019
PHPUnit in 4 parts - ConFoo 2019
 
SPL to the Rescue - Tek 09
SPL to the Rescue - Tek 09SPL to the Rescue - Tek 09
SPL to the Rescue - Tek 09
 
extending-php
extending-phpextending-php
extending-php
 

Similar to John's Top PECL Picks

Similar to John's Top PECL Picks (20)

php
phpphp
php
 
php
phpphp
php
 
Phalcon 2 - PHP Brazil Conference
Phalcon 2 - PHP Brazil ConferencePhalcon 2 - PHP Brazil Conference
Phalcon 2 - PHP Brazil Conference
 
Phalcon - Giant Killer
Phalcon - Giant KillerPhalcon - Giant Killer
Phalcon - Giant Killer
 
PEAR For The Masses
PEAR For The MassesPEAR For The Masses
PEAR For The Masses
 
Php ppt
Php pptPhp ppt
Php ppt
 
Php basics
Php basicsPhp basics
Php basics
 
Php Best Practices
Php Best PracticesPhp Best Practices
Php Best Practices
 
Php Best Practices
Php Best PracticesPhp Best Practices
Php Best Practices
 
PHP Hypertext Preprocessor
PHP Hypertext PreprocessorPHP Hypertext Preprocessor
PHP Hypertext Preprocessor
 
Php
PhpPhp
Php
 
Php
PhpPhp
Php
 
Php
PhpPhp
Php
 
Php advance
Php advancePhp advance
Php advance
 
PerlScripting
PerlScriptingPerlScripting
PerlScripting
 
Php through the eyes of a hoster confoo
Php through the eyes of a hoster confooPhp through the eyes of a hoster confoo
Php through the eyes of a hoster confoo
 
Flyr PHP micro-framework
Flyr PHP micro-frameworkFlyr PHP micro-framework
Flyr PHP micro-framework
 
Running Symfony
Running SymfonyRunning Symfony
Running Symfony
 
PHP Conference - Phalcon hands-on
PHP Conference - Phalcon hands-onPHP Conference - Phalcon hands-on
PHP Conference - Phalcon hands-on
 
PHP LFI to Arbitrary Code Execution via rfc1867 file upload temporary files
PHP LFI to Arbitrary Code Execution via rfc1867 file upload temporary filesPHP LFI to Arbitrary Code Execution via rfc1867 file upload temporary files
PHP LFI to Arbitrary Code Execution via rfc1867 file upload temporary files
 

More from John Coggeshall

More from John Coggeshall (20)

Virtualization for Developers
Virtualization for DevelopersVirtualization for Developers
Virtualization for Developers
 
Migrating to PHP 7
Migrating to PHP 7Migrating to PHP 7
Migrating to PHP 7
 
Peek at PHP 7
Peek at PHP 7Peek at PHP 7
Peek at PHP 7
 
ZF2 Modules: Events, Services, and of course, modularity
ZF2 Modules: Events, Services, and of course, modularityZF2 Modules: Events, Services, and of course, modularity
ZF2 Modules: Events, Services, and of course, modularity
 
PHP Development for Google Glass using Phass
PHP Development for Google Glass using PhassPHP Development for Google Glass using Phass
PHP Development for Google Glass using Phass
 
Virtualization for Developers
Virtualization for DevelopersVirtualization for Developers
Virtualization for Developers
 
Development with Vagrant
Development with VagrantDevelopment with Vagrant
Development with Vagrant
 
Introduction to Zend Framework 2
Introduction to Zend Framework 2Introduction to Zend Framework 2
Introduction to Zend Framework 2
 
10 things not to do at a Startup
10 things not to do at a Startup10 things not to do at a Startup
10 things not to do at a Startup
 
Virtualization for Developers
Virtualization for DevelopersVirtualization for Developers
Virtualization for Developers
 
Puppet
PuppetPuppet
Puppet
 
Building PHP Powered Android Applications
Building PHP Powered Android ApplicationsBuilding PHP Powered Android Applications
Building PHP Powered Android Applications
 
Ria Applications And PHP
Ria Applications And PHPRia Applications And PHP
Ria Applications And PHP
 
Beyond the Browser
Beyond the BrowserBeyond the Browser
Beyond the Browser
 
Apache Con 2008 Top 10 Mistakes
Apache Con 2008 Top 10 MistakesApache Con 2008 Top 10 Mistakes
Apache Con 2008 Top 10 Mistakes
 
Ria Development With Flex And PHP
Ria Development With Flex And PHPRia Development With Flex And PHP
Ria Development With Flex And PHP
 
Top 10 Scalability Mistakes
Top 10 Scalability MistakesTop 10 Scalability Mistakes
Top 10 Scalability Mistakes
 
Enterprise PHP: A Case Study
Enterprise PHP: A Case StudyEnterprise PHP: A Case Study
Enterprise PHP: A Case Study
 
Building Dynamic Web Applications on i5 with PHP
Building Dynamic Web Applications on i5 with PHPBuilding Dynamic Web Applications on i5 with PHP
Building Dynamic Web Applications on i5 with PHP
 
PHP Security Basics
PHP Security BasicsPHP Security Basics
PHP Security Basics
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 

John's Top PECL Picks