Node.Js for PHP Developers - Daniel Howard

Node.Js for PHP Developers

Porting PHP to Node.js

(Autor)

Buch | Softcover
288 Seiten
2012
O'Reilly Media, Inc, USA (Verlag)
978-1-4493-3360-7 (ISBN)
26,90 inkl. MwSt
If you're a PHP developer, you too can take advantage of the incredible capabilities of Node.js. This book provides several practical recipes for porting your existing PHP code to Node, and what you can achieve with this open source framework once you're done. By comparing specific PHP features with their Node counterparts, author Daniel Howard demonstrates how the concept behind PHP has evolved in Node. In the process, Howard details experience porting his own SourceForge project from PHP to Node, with specific search-and-replace commands that you can use to transform the code. You'll also learn the similarities between PHP and JavaScript.
If you’re an experienced PHP developer, you already have a head start on learning how to write Node.js code. In this book, author Daniel Howard demonstrates the remarkable similarities between the two languages, and shows you how to port your entire PHP web application to Node.js. By comparing specific PHP features with their Node counterparts, you’ll also discover how to refactor and improve existing PHP 4 or PHP 5 source code.
At the end, you’ll have two fully functional codebases to provide to your users. You can update both of them simultaneously, using this book as a reference to important aspects of PHP and Node.js.
  • Use a simple Node.js framework to convert individual PHP pages to Node.js files
  • Refactor blocking PHP source code to non-blocking Node.js source code that uses callbacks
  • Convert PHP syntax, variables, and types to Node.js
  • Use a step-by-step technique for implementing PHP classes and class inheritance in Node.js
  • Convert PHP file handling APIs into their Node.js equivalents
  • Compare approaches for using a MySQL database in Node.js and PHP
  • Convert PHP code for JSON or XML APIs into Node.js code for npm packages

Daniel Howard has worked as a software developer for over 15 years. He has worked at startups, Fortune 500 companies, and several in between. He has seen companies and individual developers struggle to move from one technology to another. He believes everybody can keep one foot firmly planted on one side and plant his other foot in the new technology, and wants to help them learn how to do so.

Chapter 1 Node.js Basics
The node and npm Executables
Stack Traces
Eclipse PDT
Chapter 2 A Simple Node.js Framework
An HTTP Server
Predefined PHP Variables
A PHP Example Page
Chapter 3 Simple Callbacks
Linearity
Making Code Linear
Chapter 4 Advanced Callbacks
Anonymous Functions, Lambdas, and Closures
PHP 5.3
PHP 4
Chapter 5 HTTP Responses
Headers
Body
A PHP Example Page
Chapter 6 Syntax
String Literals
Syntax Differences
PHP Alternative Syntax
Chapter 7 Variables
Simple Variables
Array Variables
Other Variable Types
Undefined Variables
Scope
Chapter 8 Classes
Encapsulation
Inheritance
PHP parent and static Keywords
Chapter 9 File Access
Reading and Writing Files
PHP file() API Function
Low-Level File Handling
Filenames
Chapter 10 MySQL Access
Database Approaches
node-mysql
Chapter 11 Plain Text, JSON, and XML
Plain Text
JSON
XML
Chapter 12 Miscellaneous Functions
Array
Time and Date
File
JSON
Math
String
Type
Text
MySQL
Variable
php.js License
Colophon

Erscheint lt. Verlag 1.2.2013
Verlagsort Sebastopol
Sprache englisch
Maße 178 x 233 mm
Gewicht 463 g
Themenwelt Informatik Web / Internet JavaScript
Informatik Web / Internet PHP
ISBN-10 1-4493-3360-5 / 1449333605
ISBN-13 978-1-4493-3360-7 / 9781449333607
Zustand Neuware
Haben Sie eine Frage zum Produkt?
Mehr entdecken
aus dem Bereich
Web-Programmierung leicht gemacht

von Thomas Theis

Buch | Softcover (2024)
Rheinwerk (Verlag)
29,90