Transcript
Page 1: PHP-Applikationen mit PEAR

16.11.05 / Page 1PHP-Applikationen mit PEARStefan Neufeind

LinuxWorld 2005, Infobühne2005, Frankfurt

Komponenten für PHP

PHP-Applikationen

mit PEAR

Page 2: PHP-Applikationen mit PEAR

16.11.05 / Page 2PHP-Applikationen mit PEARStefan Neufeind

LinuxWorld 2005, Infobühne2005, Frankfurt

Über mich

Stefan Neufeind, aus NeussZertifizierter PHP-EntwicklerPEAR-Maintainer seit 2 JahrenTätig für SpeedPartner GmbH

Webhosting, Serverhousing, RackspaceBusiness-DSL, Einwahl/RoamingDomainsConsultingEntwicklung (auch PHP mit PEAR)

Page 3: PHP-Applikationen mit PEAR

16.11.05 / Page 3PHP-Applikationen mit PEARStefan Neufeind

LinuxWorld 2005, Infobühne2005, Frankfurt

Agenda

Was ist PEAR?PEAR-PaketePEAR installieren / Der PEAR-InstallerNeu in PEAR 1.4.xPEAR-BeispielPEAR-WebsiteHilfe zu PEARLinks

Page 4: PHP-Applikationen mit PEAR

16.11.05 / Page 4PHP-Applikationen mit PEARStefan Neufeind

LinuxWorld 2005, Infobühne2005, Frankfurt

Was ist PEAR?

PHP Extension and Application Repository

DAS Repository für PHPGegründet 1999 von Stig S. BakkenSammlung von hochqualitativen PHP-Komponenten485 Paketen (stark steigend) in 41 Kategorien252 Paket-Betreuer, 877 Entwickler100% Open Source (Lizenzen: PHP, Apache, BSD, LGPL)Tools für Kommunikation und Zusammenarbeit

Page 5: PHP-Applikationen mit PEAR

16.11.05 / Page 5PHP-Applikationen mit PEARStefan Neufeind

LinuxWorld 2005, Infobühne2005, Frankfurt

Was ist PEAR?

Besteht aus:Website (Präsentation, Backend für Installer, ...)Installer (Kommandozeile, Web, GUI)PaketenDokumentationSupportQualitätssicherung (PEAR-QA)

Page 6: PHP-Applikationen mit PEAR

16.11.05 / Page 6PHP-Applikationen mit PEARStefan Neufeind

LinuxWorld 2005, Infobühne2005, Frankfurt

PEAR-Pakete

Keine Applikationen (fast keine :-) )sondern Komponenten für einzelne Aufgaben

DatenbankabstraktionWebservicesInternationalisierungNetzwerk / InternetGrafikerzeugung / -bearbeitungPrüfroutinen (Emailadressen, IBAN, Kreditkarten, ...)

Page 7: PHP-Applikationen mit PEAR

16.11.05 / Page 7PHP-Applikationen mit PEARStefan Neufeind

LinuxWorld 2005, Infobühne2005, Frankfurt

PEAR-Pakete

Komponenten universell einsetzbarKooperation statt konkurrierende Pakete„Sauberes“ DesignKlare Regeln zur Qualitätssicherung und WartbarkeitVerwendung in zahlreichen ApplikationenBusiness-ready

Page 8: PHP-Applikationen mit PEAR

16.11.05 / Page 8PHP-Applikationen mit PEARStefan Neufeind

LinuxWorld 2005, Infobühne2005, Frankfurt

PEAR installieren

PEAR-Installer seit PHP 4.3.0 bundledAutomatisch verfügbar, auch auf Windows :-)Standardmäßig auch beim selbst-kompilieren aktiviert

Für frühere PHP-Versionen / Distributionen ohne PEAReinfach von http://go-pear.org installieren

z.B. lynx -source http://go-pear.org | php -qoder go-pear-Source speichern und im Browser öffnen

Hinweis:PEAR-Pfad sollte im include_path (php.ini) enthalten sein

Page 9: PHP-Applikationen mit PEAR

16.11.05 / Page 9PHP-Applikationen mit PEARStefan Neufeind

LinuxWorld 2005, Infobühne2005, Frankfurt

PEAR-Installer

Einheitliche Installation-Umgebung für PHP-Code (PEAR)und C-Erweiterungen (PECL, http://pecl.php.net)Auf vielen Plattformen lauffähig (Linux, Windows, ...)Verschiedene Oberflächen:Kommandozeile, Web, GUIVerwaltung von Paket-AbhängigkeitenTools für Entwickler

Page 10: PHP-Applikationen mit PEAR

16.11.05 / Page 10PHP-Applikationen mit PEARStefan Neufeind

LinuxWorld 2005, Infobühne2005, Frankfurt

PEAR-Installer

Installation von Paketen (z.B. Kommandozeile)mit Überprüfung von Abhängigkeiten, Konflikten etc.:

Ermöglicht auch optionale Komponenten, Versionsabhängigkeiten, ...

# pear install Validate_Finance-alphaDid not download dependencies: pear/Validate, use --alldeps or --onlyreqdeps to download automaticallypear/Validate_Finance requires package "pear/Validate" (version >= 0.5.0)No valid packages foundinstall failed

Page 11: PHP-Applikationen mit PEAR

16.11.05 / Page 11PHP-Applikationen mit PEARStefan Neufeind

LinuxWorld 2005, Infobühne2005, Frankfurt

PEAR-Installer

Installation von Paketen:# pear install Validate-alphaDid not download dependencies: pear/Date, use --alldeps or --onlyreqdeps to download automaticallypear/Validate can optionally use package "pear/Date"downloading Validate-0.5.0.tgz ...Starting to download Validate-0.5.0.tgz (9,862 bytes).....done: 9,862 bytesinstall ok: channel://pear.php.net/Validate-0.5.0# pear install Validate_Finance-alphadownloading Validate_Finance-0.5.0.tgz ...Starting to download Validate_Finance-0.5.0.tgz (5,608 bytes).....done: 5,608 bytesinstall ok: channel://pear.php.net/Validate_Finance-0.5.0

Page 12: PHP-Applikationen mit PEAR

16.11.05 / Page 12PHP-Applikationen mit PEARStefan Neufeind

LinuxWorld 2005, Infobühne2005, Frankfurt

Neu in PEAR 1.4.x

Automatische Auflösung von Abhängigkeiten--onlyreqdeps / -o--alldeps / -a

Abhängigkeiten auf externe PaketeVerweise per URL

ChannelsVerwendung von mehreren ChannelsMöglichkeit eigenen Channel zu eröffnen

Mirroring

Page 13: PHP-Applikationen mit PEAR

16.11.05 / Page 13PHP-Applikationen mit PEARStefan Neufeind

LinuxWorld 2005, Infobühne2005, Frankfurt

Neu in PEAR 1.4.x

Mehrere Module in einem PaketPost-install-Skripte (inkl. Interaktion), z.B. für

Initialisierung DatenbankenDateien ins Webroot verschieben

ReST-WebservicePHAR-Support

Nur eine PHP-Datei inkl. Archiv, dynamischem Entpacken, ...Remote-InstallationInstallation von binären PECL-Paketen (z.B. auf Windows)

Page 14: PHP-Applikationen mit PEAR

16.11.05 / Page 14PHP-Applikationen mit PEARStefan Neufeind

LinuxWorld 2005, Infobühne2005, Frankfurt

PEAR-Channels

Weitere Kommandos für Channels:pear channel-discover http://example.com/channel.xmlpear channel-alias channel://... examplepear update-channels

Channel-Beschreibung per channel.xml

# pear list-channelsRegistered Channels:====================Channel Summarypear.php.net PHP Extension and Application Repositorypecl.php.net PHP Extension Community Library__uri Pseudo-channel for static packages

Page 15: PHP-Applikationen mit PEAR

16.11.05 / Page 15PHP-Applikationen mit PEARStefan Neufeind

LinuxWorld 2005, Infobühne2005, Frankfurt

PEAR-Channels

pearadise.net:Portal fürPEAR-Channels

Page 16: PHP-Applikationen mit PEAR

16.11.05 / Page 16PHP-Applikationen mit PEARStefan Neufeind

LinuxWorld 2005, Infobühne2005, Frankfurt

ReST-Webservice

PEAR <=1.3 verwendete XML-RPC für Repository-ZugriffEtabliert, aber teilweise komplex

PEAR 1.4 verwendet ReSTText-basiert, statische Files möglichWeniger TrafficSchnellere AntwortzeitenVereinfachte APIWesentlich flexibler

Page 17: PHP-Applikationen mit PEAR

16.11.05 / Page 17PHP-Applikationen mit PEARStefan Neufeind

LinuxWorld 2005, Infobühne2005, Frankfurt

Post-install Skripte

Ermöglichen umfangreiche Aktionen nach InstallationSehr flexible APISkript-Aufrufe in package2.xml definiertAufgaben können an bestimmte Dateien gebunden werdenVordefinierte Aktionen verfügbarEigene Aktionen über PHP-Skripte implementierbarAbarbeitung in einzelne Schritte gegliedertInteraktion zwischen Benutzer / PEAR installer

Page 18: PHP-Applikationen mit PEAR

16.11.05 / Page 18PHP-Applikationen mit PEARStefan Neufeind

LinuxWorld 2005, Infobühne2005, Frankfurt

PEAR-Beispiel

Nutzung von PEAR-Paketen,z.B. Grapherzeugung mit PEAR::Image_Graph:

require_once 'Image/Graph.php';// create the graph$Graph =& Image_Graph::factory('graph', array(400, 300)); // add a TrueType font$Font =& $Graph->addNew('font', 'Verdana');// set the font size to 11 pixels$Font->setSize(8);$Graph->setFont($Font);[...]

Page 19: PHP-Applikationen mit PEAR

16.11.05 / Page 19PHP-Applikationen mit PEARStefan Neufeind

LinuxWorld 2005, Infobühne2005, Frankfurt

PEAR-Beispiel

$Graph->add( Image_Graph::vertical( Image_Graph::factory('title', array('Smoothed Area Chart Sample', 12)), Image_Graph::vertical( $Plotarea = Image_Graph::factory('plotarea'), $Legend = Image_Graph::factory('legend'), 90), 5));$Legend->setPlotarea($Plotarea);// create the dataset$Dataset =& Image_Graph::factory('random', array(10, 2, 15, true));// create 1st plot as smoothed area chart using the 1st dataset$Plot =& $Plotarea->addNew('Image_Graph_Plot_Smoothed_Area', array(&$Dataset));

Page 20: PHP-Applikationen mit PEAR

16.11.05 / Page 20PHP-Applikationen mit PEARStefan Neufeind

LinuxWorld 2005, Infobühne2005, Frankfurt

PEAR-Beispiel

// set a line color$Plot->setLineColor('gray');// set a standard fill style $Plot->setFillColor('[email protected]');// output the Graph$Graph->done();?>

Page 21: PHP-Applikationen mit PEAR

16.11.05 / Page 21PHP-Applikationen mit PEARStefan Neufeind

LinuxWorld 2005, Infobühne2005, Frankfurt

PEAR-Beispiel

Page 22: PHP-Applikationen mit PEAR

16.11.05 / Page 22PHP-Applikationen mit PEARStefan Neufeind

LinuxWorld 2005, Infobühne2005, Frankfurt

PEAR-Website

Überblick über einige Dienste/Features:Struktur des Repository (Pakete)Paket-/Release-VerwaltungAbstimmungstool: PEAR Proposal-System („PEPr“)

[... ausführliche Live-Demo am PEAR-Stand ...]

Page 23: PHP-Applikationen mit PEAR

16.11.05 / Page 23PHP-Applikationen mit PEARStefan Neufeind

LinuxWorld 2005, Infobühne2005, Frankfurt

PEAR-Website

Struktur des Repository (Pakete)

Page 24: PHP-Applikationen mit PEAR

16.11.05 / Page 24PHP-Applikationen mit PEARStefan Neufeind

LinuxWorld 2005, Infobühne2005, Frankfurt

PEAR-Website

Struktur des Repository (Pakete)

Page 25: PHP-Applikationen mit PEAR

16.11.05 / Page 25PHP-Applikationen mit PEARStefan Neufeind

LinuxWorld 2005, Infobühne2005, Frankfurt

PEAR-Website

Paket-/Release-Verwaltung

Page 26: PHP-Applikationen mit PEAR

16.11.05 / Page 26PHP-Applikationen mit PEARStefan Neufeind

LinuxWorld 2005, Infobühne2005, Frankfurt

PEAR-Website

Paket-/Release-Verwaltung

Page 27: PHP-Applikationen mit PEAR

16.11.05 / Page 27PHP-Applikationen mit PEARStefan Neufeind

LinuxWorld 2005, Infobühne2005, Frankfurt

PEAR-Website

Abstimmungstool: PEAR Proposal-System („PEPr“)

Page 28: PHP-Applikationen mit PEAR

16.11.05 / Page 28PHP-Applikationen mit PEARStefan Neufeind

LinuxWorld 2005, Infobühne2005, Frankfurt

PEAR-Website

Abstimmungstool: PEAR Proposal-System („PEPr“)

Page 29: PHP-Applikationen mit PEAR

16.11.05 / Page 29PHP-Applikationen mit PEARStefan Neufeind

LinuxWorld 2005, Infobühne2005, Frankfurt

PEAR-Website

Abstimmungstool: PEAR Proposal-System („PEPr“)

Voting durch erfahrenePEAR-Entwickler

Verwaltung abgegebener StimmenPaket akzeptiert abSumme von +5 Stimmen

Tracking von Kommentaren

Page 30: PHP-Applikationen mit PEAR

16.11.05 / Page 30PHP-Applikationen mit PEARStefan Neufeind

LinuxWorld 2005, Infobühne2005, Frankfurt

PEAR-Website

Website / PräsentationDarstellung von Komponenten / ApplikationenVerwaltung von Downloads / Releases

MitgliederverwaltungVerwaltung von Betreuern, Helfern, ...

DokumentationVerwaltung von DokumentationenAutomatische Generierung von Dokumentation (API-docs)Bereitstellung von versch. Formen (Sprachen, Dateiformate)

Page 31: PHP-Applikationen mit PEAR

16.11.05 / Page 31PHP-Applikationen mit PEARStefan Neufeind

LinuxWorld 2005, Infobühne2005, Frankfurt

PEAR-Website

KommunikationMailinglisten / ForenChat (z.B. IRC)BugtrackerAbstimmungstool: PEAR Proposal-System („PEPr“)

Versionsverwaltung (http://cvs.php.net/pear/)Gemeinsames Arbeiten am „gleichen“ CodeVerwaltung von Versionsständen / Änderungen

Page 32: PHP-Applikationen mit PEAR

16.11.05 / Page 32PHP-Applikationen mit PEARStefan Neufeind

LinuxWorld 2005, Infobühne2005, Frankfurt

Hilfe zu PEAR

1. PEAR Website2. Paket-Website

http://pear.php.net/package/<paketname>3. PEAR-Dokumentation: http://pear.php.net/manual/en/4. Support-Mailingliste: [email protected]. IRC channel: #pear@EFNet6. Direkter Kontakt zum Maintainer (siehe Paket-Website)7. PEAR QA: [email protected]

Page 33: PHP-Applikationen mit PEAR

16.11.05 / Page 33PHP-Applikationen mit PEARStefan Neufeind

LinuxWorld 2005, Infobühne2005, Frankfurt

Links

PEAR-Website: http://pear.php.net/PECL-Website: http://pecl.php.net/PEAR-Dokumentation: http://pear.php.net/manual/en/Support-Mailingliste: [email protected] channel: #pear@EFNetPortal für PEAR-Channels: http://pearadise.net/Beispiele / Screenshots für PEAR::Image_Graph:http://pear.veggerby.dk/Informationen zu ReST:http://www.xfront.com/REST-Web-Services.html

Page 34: PHP-Applikationen mit PEAR

16.11.05 / Page 34PHP-Applikationen mit PEARStefan Neufeind

LinuxWorld 2005, Infobühne2005, Frankfurt

Danke für Ihre Aufmerksamkeit!

Aktuelle Folien verfügbar unter:http://talks.speedpartner.de/

Fragen?neufeind (at) speedpartner.de


Recommended