This document provides an overview of Node.js for PHP developers, comparing and contrasting features between the two languages/platforms. It covers key differences in variables, data types, operators, functions, classes/objects, modules and other concepts. The document aims to help PHP developers transition to Node.js by highlighting both similarities and differences at a conceptual level.
Scaling Symfony2 apps with RabbitMQ - Symfony UK MeetupKacper Gunia
Slides from my talk at Symfony UK Meetup. London, 20 Aug 2014. http://twitter.com/cakper
Video: https://www.youtube.com/watch?v=cha92Og9M5A
More Domain-Driven Design related content at: https://domaincentric.net/
Rich Model And Layered Architecture in SF2 ApplicationKirill Chebunin
Presentation for Symfony Camp UA 2012.
* What are Rich Model, Service Layer & Layered Architecture
* Layered architecture in Sf2 Application
* Integration with 3rd party bundles
Sprockets is an easy solution to managing large JavaScript codebases by letting you structure it, bundle it with related assets, and consolidate it as one single file, with pre-baked command-line tooling, CGI front and Rails plugin. It's a framework-agnostic open-source solution that makes for great serving performance while helping you structure and manage your codebase better.
Scaling Symfony2 apps with RabbitMQ - Symfony UK MeetupKacper Gunia
Slides from my talk at Symfony UK Meetup. London, 20 Aug 2014. http://twitter.com/cakper
Video: https://www.youtube.com/watch?v=cha92Og9M5A
More Domain-Driven Design related content at: https://domaincentric.net/
Rich Model And Layered Architecture in SF2 ApplicationKirill Chebunin
Presentation for Symfony Camp UA 2012.
* What are Rich Model, Service Layer & Layered Architecture
* Layered architecture in Sf2 Application
* Integration with 3rd party bundles
Sprockets is an easy solution to managing large JavaScript codebases by letting you structure it, bundle it with related assets, and consolidate it as one single file, with pre-baked command-line tooling, CGI front and Rails plugin. It's a framework-agnostic open-source solution that makes for great serving performance while helping you structure and manage your codebase better.
Building Modern and Secure PHP Applications – Codementor Office Hours with Be...Arc & Codementor
Codementor PHP expert mentor Ben Edmunds is the co-host of PHP Town Hall and author of Building Secure PHP Apps.
Ben is also the creator of Ion Auth, a simple, lightweight authentication library for CodeIgniter.
In an interactive format, Ben talked about:
Modern PHP
Latest PHP tools
SQL Injection
Password Hashing and Authentication
Other Common Hacks
https://www.codementor.io/benedmunds
https://www.codementor.io/php-tutorial/building-modern-secure-php-applications-codementor-office-hours-ben-edmunds
Roles are an excellent object-oriented tool both for allomorphism and for
reuse.
Roles facilitate allomorphism by favoring "does this object do X" versus "is
this object a subclass of X". You often care more about capability than
inheritance. In a sense, roles encode types better than inheritance.
Roles also provide an excellent faculty for reuse. This effectively eliminates
multiple inheritance, which is often the only solution for sharing code between
unrelated classes.
Roles can combine with conflict detection. This eliminates accidental shadowing
of methods that is painful with multiple inheritance and mixins.
Parameterized roles (via MooseX::Role::Parameterized) improve the reusability
of roles by letting each consumer cater the role to its needs. This does
sacrifice some allomorphism, but there are ways to restore it.
Part of a series of talk to help you write your first Perl 6 program today. So its basic syntax and concepts of its object orientation and a comparison to the widely used P5 OO system Moose which is similar by no accident.
Love it or hate it, JavaScript is playing an increasingly important role in the next generation of web and mobile apps. As code continues to move from the server to the client, JavaScript is being used to do more than simple HTML manipulation. Be prepared for this transition and make sure the JavaScript you write is optimized and ready to perform on desktops and devices! In this session, you will learn ten practical tips that you can use today to write faster, more maintainable, memory friendly JavaScript.
This was a talk given at HTML5DevConf SF in 2015.
Ever wanted to write your own Browserify or Babel? Maybe have an idea for something new? This talk will get you started understanding how to use a JavaScript AST to transform and generate new code.
Building Modern and Secure PHP Applications – Codementor Office Hours with Be...Arc & Codementor
Codementor PHP expert mentor Ben Edmunds is the co-host of PHP Town Hall and author of Building Secure PHP Apps.
Ben is also the creator of Ion Auth, a simple, lightweight authentication library for CodeIgniter.
In an interactive format, Ben talked about:
Modern PHP
Latest PHP tools
SQL Injection
Password Hashing and Authentication
Other Common Hacks
https://www.codementor.io/benedmunds
https://www.codementor.io/php-tutorial/building-modern-secure-php-applications-codementor-office-hours-ben-edmunds
Roles are an excellent object-oriented tool both for allomorphism and for
reuse.
Roles facilitate allomorphism by favoring "does this object do X" versus "is
this object a subclass of X". You often care more about capability than
inheritance. In a sense, roles encode types better than inheritance.
Roles also provide an excellent faculty for reuse. This effectively eliminates
multiple inheritance, which is often the only solution for sharing code between
unrelated classes.
Roles can combine with conflict detection. This eliminates accidental shadowing
of methods that is painful with multiple inheritance and mixins.
Parameterized roles (via MooseX::Role::Parameterized) improve the reusability
of roles by letting each consumer cater the role to its needs. This does
sacrifice some allomorphism, but there are ways to restore it.
Part of a series of talk to help you write your first Perl 6 program today. So its basic syntax and concepts of its object orientation and a comparison to the widely used P5 OO system Moose which is similar by no accident.
Love it or hate it, JavaScript is playing an increasingly important role in the next generation of web and mobile apps. As code continues to move from the server to the client, JavaScript is being used to do more than simple HTML manipulation. Be prepared for this transition and make sure the JavaScript you write is optimized and ready to perform on desktops and devices! In this session, you will learn ten practical tips that you can use today to write faster, more maintainable, memory friendly JavaScript.
This was a talk given at HTML5DevConf SF in 2015.
Ever wanted to write your own Browserify or Babel? Maybe have an idea for something new? This talk will get you started understanding how to use a JavaScript AST to transform and generate new code.
PHP 5.3 has many new features that allow very different paradigms of software development, that may be unfamiliar to many PHP developers. If you want to learn more about functional or aspect-oriented programming, or how to organize your PHP libraries according to the new de facto PHP namespacing standard, don't miss this talk.
The following illustrates some of the common security challanges Node.js developers are up against. The presentation covers various types of JavaScript-related hacks and NoSQL injection hacking via Express and MongoDB.
This presentation is for those students and IT professionals who have basic programming knowledge and want to learn Perl basics for Pentesting.
We have explained minimal Perl basics which a pentester should know to write,read,modify Perl scripts for Pentesting like data type, comparison operator, loop controls, minimal CPAN modules related to web and networking, perl scripts in Kali and some demo
[PL] Jak nie zostać "programistą" PHP?Radek Benkel
Po sieci krąży wiele opinii, jak to programiści PHP nie są prawdziwymi programistami i że PHP to w ogóle nie jest język programowania, etc.
A winni takiego stanu rzeczy są sami programiści bądź właśnie „programiści”. Dlaczego? W każdym języku da się napisać kod zły jak i dobry. A w świecie PHP niestety dużo jest tego złego – choć trend ten zmienia się na lepsze.
Celem wykładu jest zapoznanie uczestników z rzeczami, na które należy zwrócić uwagę podczas tworzenia aplikacji w języku PHP. Druga (krótsza) część prezentacji będzie poświęcona ogólnym dobrym praktykom programistycznym, nie związanym z żadnym konkretnym językiem.
We all love infrastructure as code, we automate everything ™ but how many
of us can really say we could destroy and recreate our core infrastructure
without human intervention. Can you be sure there isnt a DNS problem or
that all the things ™ are done in the right order This talk walks the
audience through a green fields exercise that sets up service discovery
using Consul, infrastructure as code using terraform, using images build
with packer and configured using puppet.
Preparing for the next PHP version (5.6)Damien Seguy
With versions stretching from 5.3 to 5.6, PHP has several major published versions, that require special attention when migrating. Beyond checking for compilation, the code must be reviewed to avoid pitfalls like obsoletes functions, new features, change in default parameters or behavior. We'll set up a checklist of such traps, and ways to find them in the code and be reading for PHP 5.6.
Code reviews are vital for ensuring good code quality. They serve as one of our last lines of defense against bugs and subpar code reaching production.
Yet, they often turn into annoying tasks riddled with frustration, hostility, unclear feedback and lack of standards. How can we improve this crucial process?
In this session we will cover:
- The Art of Effective Code Reviews
- Streamlining the Review Process
- Elevating Reviews with Automated Tools
By the end of this presentation, you'll have the knowledge on how to organize and improve your code review proces
Globus Connect Server Deep Dive - GlobusWorld 2024Globus
We explore the Globus Connect Server (GCS) architecture and experiment with advanced configuration options and use cases. This content is targeted at system administrators who are familiar with GCS and currently operate—or are planning to operate—broader deployments at their institution.
Accelerate Enterprise Software Engineering with PlatformlessWSO2
Key takeaways:
Challenges of building platforms and the benefits of platformless.
Key principles of platformless, including API-first, cloud-native middleware, platform engineering, and developer experience.
How Choreo enables the platformless experience.
How key concepts like application architecture, domain-driven design, zero trust, and cell-based architecture are inherently a part of Choreo.
Demo of an end-to-end app built and deployed on Choreo.
Strategies for Successful Data Migration Tools.pptxvarshanayak241
Data migration is a complex but essential task for organizations aiming to modernize their IT infrastructure and leverage new technologies. By understanding common challenges and implementing these strategies, businesses can achieve a successful migration with minimal disruption. Data Migration Tool like Ask On Data play a pivotal role in this journey, offering features that streamline the process, ensure data integrity, and maintain security. With the right approach and tools, organizations can turn the challenge of data migration into an opportunity for growth and innovation.
Enhancing Research Orchestration Capabilities at ORNL.pdfGlobus
Cross-facility research orchestration comes with ever-changing constraints regarding the availability and suitability of various compute and data resources. In short, a flexible data and processing fabric is needed to enable the dynamic redirection of data and compute tasks throughout the lifecycle of an experiment. In this talk, we illustrate how we easily leveraged Globus services to instrument the ACE research testbed at the Oak Ridge Leadership Computing Facility with flexible data and task orchestration capabilities.
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...Hivelance Technology
Cryptocurrency trading bots are computer programs designed to automate buying, selling, and managing cryptocurrency transactions. These bots utilize advanced algorithms and machine learning techniques to analyze market data, identify trading opportunities, and execute trades on behalf of their users. By automating the decision-making process, crypto trading bots can react to market changes faster than human traders
Hivelance, a leading provider of cryptocurrency trading bot development services, stands out as the premier choice for crypto traders and developers. Hivelance boasts a team of seasoned cryptocurrency experts and software engineers who deeply understand the crypto market and the latest trends in automated trading, Hivelance leverages the latest technologies and tools in the industry, including advanced AI and machine learning algorithms, to create highly efficient and adaptable crypto trading bots
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Globus
Large Language Models (LLMs) are currently the center of attention in the tech world, particularly for their potential to advance research. In this presentation, we'll explore a straightforward and effective method for quickly initiating inference runs on supercomputers using the vLLM tool with Globus Compute, specifically on the Polaris system at ALCF. We'll begin by briefly discussing the popularity and applications of LLMs in various fields. Following this, we will introduce the vLLM tool, and explain how it integrates with Globus Compute to efficiently manage LLM operations on Polaris. Attendees will learn the practical aspects of setting up and remotely triggering LLMs from local machines, focusing on ease of use and efficiency. This talk is ideal for researchers and practitioners looking to leverage the power of LLMs in their work, offering a clear guide to harnessing supercomputing resources for quick and effective LLM inference.
How to Position Your Globus Data Portal for Success Ten Good PracticesGlobus
Science gateways allow science and engineering communities to access shared data, software, computing services, and instruments. Science gateways have gained a lot of traction in the last twenty years, as evidenced by projects such as the Science Gateways Community Institute (SGCI) and the Center of Excellence on Science Gateways (SGX3) in the US, The Australian Research Data Commons (ARDC) and its platforms in Australia, and the projects around Virtual Research Environments in Europe. A few mature frameworks have evolved with their different strengths and foci and have been taken up by a larger community such as the Globus Data Portal, Hubzero, Tapis, and Galaxy. However, even when gateways are built on successful frameworks, they continue to face the challenges of ongoing maintenance costs and how to meet the ever-expanding needs of the community they serve with enhanced features. It is not uncommon that gateways with compelling use cases are nonetheless unable to get past the prototype phase and become a full production service, or if they do, they don't survive more than a couple of years. While there is no guaranteed pathway to success, it seems likely that for any gateway there is a need for a strong community and/or solid funding streams to create and sustain its success. With over twenty years of examples to draw from, this presentation goes into detail for ten factors common to successful and enduring gateways that effectively serve as best practices for any new or developing gateway.
Advanced Flow Concepts Every Developer Should KnowPeter Caitens
Tim Combridge from Sensible Giraffe and Salesforce Ben presents some important tips that all developers should know when dealing with Flows in Salesforce.
Understanding Globus Data Transfers with NetSageGlobus
NetSage is an open privacy-aware network measurement, analysis, and visualization service designed to help end-users visualize and reason about large data transfers. NetSage traditionally has used a combination of passive measurements, including SNMP and flow data, as well as active measurements, mainly perfSONAR, to provide longitudinal network performance data visualization. It has been deployed by dozens of networks world wide, and is supported domestically by the Engagement and Performance Operations Center (EPOC), NSF #2328479. We have recently expanded the NetSage data sources to include logs for Globus data transfers, following the same privacy-preserving approach as for Flow data. Using the logs for the Texas Advanced Computing Center (TACC) as an example, this talk will walk through several different example use cases that NetSage can answer, including: Who is using Globus to share data with my institution, and what kind of performance are they able to achieve? How many transfers has Globus supported for us? Which sites are we sharing the most data with, and how is that changing over time? How is my site using Globus to move data internally, and what kind of performance do we see for those transfers? What percentage of data transfers at my institution used Globus, and how did the overall data transfer performance compare to the Globus users?
First Steps with Globus Compute Multi-User EndpointsGlobus
In this presentation we will share our experiences around getting started with the Globus Compute multi-user endpoint. Working with the Pharmacology group at the University of Auckland, we have previously written an application using Globus Compute that can offload computationally expensive steps in the researcher's workflows, which they wish to manage from their familiar Windows environments, onto the NeSI (New Zealand eScience Infrastructure) cluster. Some of the challenges we have encountered were that each researcher had to set up and manage their own single-user globus compute endpoint and that the workloads had varying resource requirements (CPUs, memory and wall time) between different runs. We hope that the multi-user endpoint will help to address these challenges and share an update on our progress here.
Software Engineering, Software Consulting, Tech Lead.
Spring Boot, Spring Cloud, Spring Core, Spring JDBC, Spring Security,
Spring Transaction, Spring MVC,
Log4j, REST/SOAP WEB-SERVICES.
Check out the webinar slides to learn more about how XfilesPro transforms Salesforce document management by leveraging its world-class applications. For more details, please connect with sales@xfilespro.com
If you want to watch the on-demand webinar, please click here: https://www.xfilespro.com/webinars/salesforce-document-management-2-0-smarter-faster-better/
Quarkus Hidden and Forbidden ExtensionsMax Andersen
Quarkus has a vast extension ecosystem and is known for its subsonic and subatomic feature set. Some of these features are not as well known, and some extensions are less talked about, but that does not make them less interesting - quite the opposite.
Come join this talk to see some tips and tricks for using Quarkus and some of the lesser known features, extensions and development techniques.
Unleash Unlimited Potential with One-Time Purchase
BoxLang is more than just a language; it's a community. By choosing a Visionary License, you're not just investing in your success, you're actively contributing to the ongoing development and support of BoxLang.
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamtakuyayamamoto1800
In this slide, we show the simulation example and the way to compile this solver.
In this solver, the Helmholtz equation can be solved by helmholtzFoam. Also, the Helmholtz equation with uniformly dispersed bubbles can be simulated by helmholtzBubbleFoam.
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar
The European Union Agency for Law Enforcement Cooperation (Europol) has suffered an alleged data breach after a notorious threat actor claimed to have exfiltrated data from its systems. Infamous data leaker IntelBroker posted on the even more infamous BreachForums hacking forum, saying that Europol suffered a data breach this month.
The alleged breach affected Europol agencies CCSE, EC3, Europol Platform for Experts, Law Enforcement Forum, and SIRIUS. Infiltration of these entities can disrupt ongoing investigations and compromise sensitive intelligence shared among international law enforcement agencies.
However, this is neither the first nor the last activity of IntekBroker. We have compiled for you what happened in the last few days. To track such hacker activities on dark web sources like hacker forums, private Telegram channels, and other hidden platforms where cyber threats often originate, you can check SOCRadar’s Dark Web News.
Stay Informed on Threat Actors’ Activity on the Dark Web with SOCRadar!
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTier1 app
Even though at surface level ‘java.lang.OutOfMemoryError’ appears as one single error; underlyingly there are 9 types of OutOfMemoryError. Each type of OutOfMemoryError has different causes, diagnosis approaches and solutions. This session equips you with the knowledge, tools, and techniques needed to troubleshoot and conquer OutOfMemoryError in all its forms, ensuring smoother, more efficient Java applications.
Developing Distributed High-performance Computing Capabilities of an Open Sci...Globus
COVID-19 had an unprecedented impact on scientific collaboration. The pandemic and its broad response from the scientific community has forged new relationships among public health practitioners, mathematical modelers, and scientific computing specialists, while revealing critical gaps in exploiting advanced computing systems to support urgent decision making. Informed by our team’s work in applying high-performance computing in support of public health decision makers during the COVID-19 pandemic, we present how Globus technologies are enabling the development of an open science platform for robust epidemic analysis, with the goal of collaborative, secure, distributed, on-demand, and fast time-to-solution analyses to support public health.
2. @AndrewEddie
• Civil Engineer (1990) turned Software Engineer (2000)
• Discovered Basic early 80's - nerd ever since
• Cut teeth on C and C++ (late 90's vintage)
• PHP Open Source contributor
• Node acolyte
3.
4. JavaScript
• Was born in 1995 (same as PHP)
• Is ECMAScript
• Shares a mostly familiar C-style syntax
• Is not Java
• Is not CoffeeScript et al
5. Node.js
• It's just server-side JavaScript (it is the server)
• V8 - very light core
• Single thread event loop
• Package management via NPM
• No real equivalent to things like SPL or PHP-FIG
18. foreach / for-in
// PHP
foreach ($objOrArr as $k => $v) {
echo "Key is $kn";
echo "- value is $vn";
}
// JavaScript
for (k in object) {
console.log("Key is %s", k);
console.log("- value is %s",
object[k]);
}
19. Function defaults
// PHP
function fetch($page, $perPage = 10) {
// ...
return $page * perPage;
}
php > fetch();
Warning: Missing argument 1 for fetch(), called in php
shell code on line 1 and defined in php shell code on
line 1
// JavaScript
function fetch(page, perPage) {
perPage = perPage || 10;
return page * perPage;
}
> fetch();
NaN
>
// Workaround?
function fetch(page, perPage) {
if (page === undefined) {
throw Error('Page missing');
}
perPage = perPage || 10;
return page * perPage;
}
21. Closures
// PHP
$mineBlock = function ($block) {
// ...
return $item;
};
$item = $mineBlock('diamond ore');
// JavaScript
var mineBlock = function (block) {
// ...
return item;
};
var item = mineBlock('diamond ore');
22. Function Scope
// PHP
// Global if in the main file.
$sky = 'blue';
function night() {
$sky = 'black';
}
night();
echo $sky; // blue
// JavaScript
// Always global.
sky = 'blue';
function night() {
sky = 'black';
}
night();
console.log(sky); // black
23. Function Scope - PHP equivalent to JavaScript
// PHP
// Global if in the main file.
$sky = 'blue';
function night() {
global $sky;
$sky = 'black';
}
night();
echo $sky; // black
// JavaScript
// Always global.
sky = 'blue';
function night() {
sky = 'black';
}
night();
console.log(sky); // black
24. Function Scope - JavaScript equivalent to PHP
// PHP
// Global if in the main file.
$sky = 'blue';
function night() {
$sky = 'black';
}
night();
echo $sky; // blue
// JavaScript
// Always local.
var sky = 'blue';
function night() {
var sky = 'black';
}
night();
console.log(sky); // blue
25. Classes?
// PHP
class Block {
public $type;
public function __construct($type) {
$this->type = $type;
}
public function getType() {
return $this->type;
}
}
$sand = new Block('sand');
// JavaScript
function Block(type) {
this.type = type;
}
Block.prototype.getType = function () {
return this.type;
}
var dirt = new Block('dirt');
26. "Classes" in JavaScript
• Constructors are just named functions
• Functions called with `new` return `this`
• `new` allows prototyping to work
• Upper CamelCase function names by convention
• No native equivalent to `protected`
• True `private` is possible but awkward
27. Inheritance - JavaScript
// PHP
class DiamondOre extends Block {
function __construct() {
this.type = 'DiamondOre';
}
}
// JavaScript
function DiamondOre() {
// Remember the original constructor
// back a slide or two took a type.
Block.call(this, 'DiamondOre');
}
DiamondOre.prototype =
Object.create(Block.prototype);
DiamondOre.prototype.constructor =
Block;
28. Inheritance - Node
// PHP
class IronOre extends Block {
function __construct() {
parent::__construct('IronOre');
}
function getType() {
return 'Unsmelted'
. parent::getType();
}
}
// JavaScript
var util = require('util');
function IronOre() {
Block.call(this, 'IronOre');
}
util.inherits(IronOre, Block);
IronOre.prototype.getType = function (){
return 'Unsmelted'
+ super_.getType();
}
29. Class closure scope - public example
// PHP
class Tool {
public $max = 5;
function register($container) {
// Pre PHP 5.4
$self = $this;
$f = function($bag) use ($self){
return count($bag)
< $self->max);
};
$container->register($f);
}
}
// JavaScript
function Tool() {
this.max = 5;
}
Tool.prototype.register = function($c){
var self = this;
var f = function (bag) {
return bag.length < self.max;
}
c.register(f);
}
30. Class closure scope - private example
// PHP
class Tool {
private $max = 5;
function register($container) {
// Pre PHP 5.4
$self = $this;
$f = function($bag) use ($self){
return count($bag)
< $self->max);
};
$container->register($f);
}
}
// Node module
// "max" is now private to Tool.
var max = 5;
Tool.prototype.register = function($c){
var self = this;
var f = function (bag) {
return bag.length < max;
}
c.register(f);
}
31. Modules
• Modules sort of equate to "class"
• Sand-boxed scope
• Returns module.exports
32. Modules - conceptual equivalence
// PHP
root
|- Game
| `- Block.php
|- vendor
| |- composer
| |- monolog
| `- autoload.php
|- index.php
`- package.json
----------
<?php
require './vendor/autoload.php';
use MonologLogger;
use GameBlock;
$log = new Logger('name');
// JavaScript
root
|- lib
| `- game
| `- index.js
|- node_modules
| `- winston
|- app.js
`- package.json
----------
// Conceptual equivalent
var winston = require('winston');
var Game = require('./lib/game');
var Block = Game.Block;
var block = new Block('DiamondOre');
33. Some popular modules
• Logging - Winston
• Promises - Bluebird, Q
• Utility classes - Lodash
• Web serving - Express
• ORM - Waterline, JugglingDB
• MVC/ADR - Build your own
35. What do to with non-public scope?
• True private - hard to test
• Could use the old PEAR underscore prefix
• Could reference them via a faux value
• Could use @private in the DocBlock
36. Thank you - Questions?
eddify.me
twitter.com/AndrewEddie
slideshare.net/AndrewEddie
delicious.com/eddieajau/node.js
Who am I? Civil engineering prepared me well for a move into software engineering. I'm mostly known for my contributions to the Joomla CMS.
Photo: NASA ASTP image gallery.
The cognitive process for context switching between languages is not always easy.
Javascript is defined by the ECMAScript standard, the name being a compromise between Microsoft and Netscape as two of the main stakeholders surrounding the inclusion of JavaScript in browsers.
PHP, incidentally was also born in 1995. Node was born in 2009 a month before the release of PHP 5.3 (ironically introducing closures).
JavaScript also has a family of derived languages, such as CoffeeScript, that have custom syntax that compile down to JavaScript. This can be a little confusing to the Node beginner because there are times you are searching for JavaScript/Node solutions and you either get people writing snippets in CoffeeScript, or, you find the source for an npm package is written in CoffeeScript, not pure JavaScript.
It's the same Javascript that runs in your browser, BUT fully compliant with the ECMAScript standard so you don't have to contend with browser differences where some features are supported and others aren't (that said, operating systems present the usual challenges for installation). But it's important to note that Node is the server - you don't need to run it under Apache or IIS to get web support, Node supports the basics itself (much like PHP 5.4's built in web server).
It's built on Chrome's V8 engine (so we are somewhat beholden to what Chrome wants to do with that) and the core library support is much, much lighter than PHP. Node expects you to extend functionality by adding modules and packages written in JavaScript (it's still all Vanilla JavaScript). While this is an over-simplification, Node includes enough for you to write a web server, at least enough for you to start handling requests and responses.
When you start a Node application, it's running in a single thread in an event loop.
The equivalent of both Composer, Packagist and PEAR in Node is NPM - the Node Package Manager.
Node documentation is divided into two zones. Node is JavaScript so the Mozilla resources are still the standard for vanilla Javascript. Node has documentation for the modules it provides (like "fs" and others). Individual modules have their own documentation with varying degrees of depth and quality.
Dash is a great tool to collect documentation offline (for Mac only) and it's worthwhile purchasing a license to get rid of the ads.
Both Node and PHP have command line interpreters. References:
http://php.net/manual/en/features.commandline.interactive.php
http://nodejs.org/api/repl.html
JavaScript has similar but fewer primitives. References
http://php.net/manual/en/language.types.php
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures
Node doesn't require a tag (like <?php) to designate that you are in the language.
PHP and JavaScript variables are both loosely typed.
In JavaScript, the "$" identifier is not necessary, but could be included if it makes you feel better. However, the "var" keyword is used to define local scope and should always be used to prevent polluting of the global scope.
Most operators share the same roll in both languages.
In JavaScript, "+" is both a string and number operator.
The "&&" and "||" operators behave a little differently in JavaScript because they resolve to a value, not a boolean (this makes the "||" operator particularly useful for assigning default values).
There are some slight differences regarding truthiness and falsiness.
References
http://php.net/manual/en/language.types.array.php | http://php.net/manual/en/class.arrayobject.php
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
Note that Array.length in JavaScript is mutable.
http://php.net/manual/en/control-structures.foreach.php
JavaScript does not have the notion of a native associative array like PHP does.
Object support in JavaScript is similar to PHP, just using the "." operator instead of "->".
Switch statements should always be used sparingly, but in JavaScript you need to remember that the comparison for cases is strict.
JavaScript's Error object is like a PHP exception, but without an error code. It is, however, a quirky object to extend. JavaScript also has a few native error types, but not nearly as rich as SPL. See:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error
Be careful of "hasOwnProperty". See
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty
Function declarations are similar. However, in JavaScript all arguments are optional (and forget about type hinting).
Because functions in JavaScript are objects, they contain a method to call themselves either with a list of arguments or an array of arguments.
Closures (anonymous functions) are provided in both languages. Note that both have their respective "this" issues.
Function scope is handled a little differently in JavaScript. Functions always have access to the global scope.
To achieve the same result in PHP you'd have to resort to the evil "global" keyword.
Or, in JavaScript land, you need to explicitly declare the variable in the local scope.
JavaScript doesn't have classes (ES6 aside), but it does have the concept of constructor functions. You can achieve constructs like class methods in JavaScript by operating on a function's prototype object (and that's another story that's beyond the scope of this talk).
Inheritance is certainly possible in JavaScript, but it's not as elegant.
Node helps us by providing an "inherits" method in a module called "util" that eliminates the repetition. Note that it also implements (manually) a "super_" object to track the parent object.
The best way to get your head around object closure scope is to imagine you are using closures in PHP 5.3, just without the "use" keyword (JavaScript automatically handles that sort of scope).
Private class variables can be handled easily in Node modules.
It's best to think of a Node module in the same way as you'd think about a PHP class. It's
Good references:
http://bites.goodeggs.com/posts/export-this/
Note that npm is little different from Composer because Node can sandbox different versions of the same library.
The "export" ui setting in Mocha gives you the closest feel for how testing is done with PHP Unit. I particularly dislike the BDD format.
In PHP, I liked being pedantic about class property and method scope. But JavaScript doesn't have the idea of protected scope, and most private things are completely inaccessible (reflection is not an option). I've begrudgingly taken to using @private notation (yes, going back to the PHP 4 days) because it makes it easier to test the inner workings of a class (methods I would normally make protected).