SlideShare a Scribd company logo
1 of 44
Place your screenshot here
Essential
Tools for
Modern PHP
Alex Weissman
GIT
PSR
Composer NODE.JS
PHP
UNIT
PHP
DOC
MARKDOWN
Fred Brooks, The Mythical Man-Month
We learn how to
make this in school
(or at home)
But this is what
we're building in
the "real world"
Git
Version control system,
the basis for Github.
Stores snapshots,
enhances collaboration.
Composer
A dependency manager
for PHP.
Node.js
An open-source cross-
platform runtime
environment, helps with
asset management and
deployment. Node Package
Manager, npm, is its
dependency manager.
PSR
Coding standards for
PHP that include
formatting, syntax, best
practices and
interoperability.
PHP Unit
Essential tool for creating
and running automated
tests.
PHP Doc
Standards for low-level
documentation
(comments) in your code
base.
Overview
Essential
Tools
Markdown
A language for formatting
plain text. Makes
communication easier.
What is the main job of a
software developer?
The ratio of time spent reading versus writing is
well over 10 to 1. We are constantly reading old
code as part of the effort to write new code.
...[Therefore,] making it easy to read makes it
easier to write.
― Robert C. Martin, Clean Code: A Handbook of
Agile Software Craftsmanship
MARKDOWN, PHPDOC,
AND CODING STYLE
01
MARKDOWN
● The format for writing readable content (especially code) on the web
● Alternative to allowing people to enter HTML, which:
○ Is more verbose and takes longer to write;
○ Requires special handling to prevent XSS attacks
MARKDOWN
MARKDOWN
https://daringfireball.net/projects/markdown/
PHPDOC
● Document each file, class, member variable, and method with a DocBlock
● DocBlocks contain both free text descriptions and structured metadata (tags)
● DocBlocks can be automatically parsed by:
○ Text editors and IDEs for type-hinting and code completion;
○ Standalone tools to generate API documentation
/**
* A BelongsToMany relationship that supports ternary (three-way) pivot relationships.
*
* @author Alex Weissman (https://alexanderweissman.com)
* @link https://github.com/laravel/framework/
*/
class BelongsToTernary extends BelongsToMany
{
…
}
PHPDOC
https://docs.phpdoc.org/
CODING STYLE
PHP Standards Recommendations (PSRs): PSR-1 and PSR-2
CODING STYLE
usrefrostieng is a web framework for php
but other web framework offers a
compleate toolbox of pogram modules for
build app.its a fully-functioning user
managment ap unlike other php famework
right out of the box and full extandable
so that you can easly create the custom
feature userfroasting design hellp new and return
devlopers up to speed at modern php so youll be
comfortably intoduce to COMPOSER and PSR for
better structure ur code and easy manage when you'll
learn use node and Bower to cleanly manage client-
side packages (JAVASCRIPT and CSS)
UserFrosting is a web framework for PHP. Like other web
frameworks, it offers a complete toolbox of programmatic
components for building your application.
Unlike other PHP frameworks, it's a fully-functioning user
management application, right out of the box. And, it's fully
extendable so that you can easily create the custom features
you need.
UserFrosting is designed to bring new and returning
developers up to speed with the modern PHP community.
You'll be comfortably introduced to Composer (the
dependency manager), object-oriented design patterns, and
the PHP Standards Recommendations (PSR), making your
code better structured and easier to manage.
What's more, you'll learn how to use Node.js and Bower to
cleanly manage client-side packages (Javascript and CSS).
Transform yourself from a code monkey into a software
engineer.
CODING STYLE
class loggedInUser {
public $email = NULL;
public $hash_pw = NULL;
public $user_id = NULL;
public $csrf_token = NULL;
// Simple function to update the last sign in of a user
public function updateLastSignIn() {
updateUserLastSignIn($this->user_id);
}
// Return the timestamp when this user's account was registered
public function signupTimeStamp(){
return fetchUserField($this->user_id, 'sign_up_stamp');
}
//csrf tokens
public function csrf_token($regen = false)
{
if($regen === true) {
//*make sure token is set, if so unset*//
if(isset($_SESSION["__csrf_token"])) {
unset($_SESSION["__csrf_token"]);
}
if (function_exists('openssl_random_pseudo_bytes')) {
$rand_num =
openssl_random_pseudo_bytes(16);//pull 16 bytes from /dev/random
}else{
CODING STYLE
namespace AppModel;
class LoggedInUser
{
public $id = NULL;
public $email = NULL;
public $password = NULL;
public $csrfToken = NULL;
/**
* Update the last sign in time of a user
*
* @return AppModelLoggedInUser
*/
public function updateLastSignIn()
{
$this->updateField('last_sign_in');
return $this;
}
/**
* Return the timestamp for when this user's account was registered
*
* @return string
*/
public function signupTimeStamp()
{
return $this->fetchField('sign_up_stamp');
}
}
PSR-1 and PSR-2
● Don’t use ?>
● 4 spaces for indentation
○ DON’T use tabs
○ DO configure your text editor to write 4 spaces when you press tab
● One statement;
● Per line;
● Control structures: opening brace on same line
● This code snippet encompasses a lot of the other formatting rules:
if ($a === $b) {
bar();
} elseif ($a > $b) {
$foo->bar($arg1);
} else {
BazClass::bar($arg2, $arg3);
}
<?php
/**
* Owl Fancy
*
* @link https://owlfancy.com
* @license All rights reserved
*/
namespace AppModels;
use AppMailMailer;
class Member
{
/**
* Email member with reminder to renew subscription.
*
* @param AppMailContact $senderInfo
* @param string $params
* @return string
*/
public function sendSubscriptionReminder($senderInfo, $params)
{
$message = new Mailer($senderInfo, $this->email);
return $message->render('bill-reminder.html.twig', $params);
}
...
}
Object-oriented programming
• Namespaces!
• Stricter naming conventions for
classes, methods
• One class per file!
• Separation of concerns. Avoid
side effects - A file should either
define symbols OR perform
logic/render content
PSR-1 and PSR-2
PSR’s don’t have rules for
everything, but you should
Be consistent, even if PSR's do not provide a specific requirement!
• Variables - choose a style like camelCase;
• Functions - camelCase;
• Array keys - snake_case;
• Double vs single quotes - single quotes when double aren’t necessary
• Naming conventions – create vs createUser vs userCreate
GIT
02
WHAT IS VERSION CONTROL?
Version control systems are a category of software
tools that help a software team manage changes
to source code over time.
- Atlassian, Git Tutorial
Life before
version control
● What has been changed from one version to
the next?
● Who made those changes, and why?
● How can I integrate changes that have been
made by multiple developers in a non-blocking
way?
● Finding specific changes and stepping back to
previous states?
● I'd like to do these things efficiently and
automatically.
A tool that solves...
Life after
version control
• I know who did what and when.
• I can easily see what has changed.
• Commit messages summarize
changes.
• Collaboration with team members
and the open source community.
• I can use it for deployment.
How git works
The working tree is my code, as it stands right
now.
A change is adding, modifying, or deleting a line
of code in my working tree.
A commit is a set of changes made by a
specific person at a specific point in time.
The repository is the current working tree
together with its commit history and various
references to specific commits.
This is all happening locally, on your machine.
ANATOMY OF A GIT REPOSITORY
alexw @ 2017-01-01 03:05:49
Fix directory traversal vulnerability
3 lines added, 4 changed, 2 removed
alexw @ 2017-01-01 22:11:17
Fix directory traversal vulnerability
for real this time
7 lines changed
sarah @ 2017-01-04 11:17:10
Improve Alex's terrible CSS
4 lines changed, 3 removed
HEAD
alexw @ 2017-01-01 03:05:49
Fix directory traversal vulnerability
3 lines added, 4 changed, 2 removed
alexw @ 2017-01-01 22:11:17
Fix directory traversal vulnerability
for real this time
7 lines changed
sarah @ 2017-01-04 11:17:10
Improve Alex's terrible CSS
4 lines changed, 3 removed
HEAD
site/
├── config/
└── default.php
├── src/
└── composer.json
alexw @ 2017-01-05 23:18:01
Turn off debugging in config
2 lines changed, 1 removed
site/
├── config/
└── default.php
├── src/
└── composer.json
commit
stage
working tree commit history
older commits
ANATOMY OF A GIT REPOSITORY
Remotes
● A remote refers to an authoritative version
of the project on a server.
● Github offers public remote repositories for
free.
● For private repos, use Bitbucket for free,
run your own git server, or get a paid
Github account.
● git clone creates a new user’s local
copy of the project, with the full history
● git push adds a user’s local commits to
the repository
● git pull adds other team member’s
changes to a user’s local copy
● Git uses various strategies to deal with
complex changes. These are fetch and
merge strategies, and learn about these in
an advanced course. Merge conflicts can
be manually resolved where needed.
Branches
● git branch creates an alternative
timeline for experimental features,
bugfixes, and divergent ideas.
● Branches can be merged or discarded as
needed.
● git checkout allows you to switch
between branches
GIT
COMPOSER
03
COMPOSER
● The dependency (package) management tool for PHP since 2012
● Downloads and installs packages from packagist.org
● Automatically resolves dependency graphs
● Designed in conjunction with PSR-4 (autoloading)
<?php
error_reporting (E_ALL ^ E_WARNING);
require('./class_definitions.inc');
require('./user_profiles.inc');
require('./file_submission.inc');
require('configurator_object.inc');
$configurators = array();
require('load_objects.inc');
unset($configurators);
session_start();
<?php
require_once __DIR__ . '/../vendor/autoload.php';
COMPOSER
{
"name": "userfrosting/userfrosting",
"require": {
"pimple/pimple": "~3.1.0",
"slim/slim": ”^3.0"
},
"autoload": {
"psr-4": {
"UserFrostingSprinkleCore": "src/"
}
}
}
composer.json
$ composer install
$ composer update
COMPOSER
userfrosting/userfrosting 4.1
pimple/pimple ~3.1.0
pimple/pimple 3.*
slimphp/slim ^3.0
psr/container 1.0
COMPOSER
userfrosting/userfrosting 4.1
pimple/pimple ~3.1.0
pimple/pimple 3.*
slimphp/slim ^3.0
psr/container 1.0
COMPOSER
vendor/
├── pimple/pimple 3.1.2
├── slimphp/slim 3.9
└── psr/container 1.0
hey man you see
that package over
there
he doesn’t use
semantic versioning
COMPOSER
AUTOMATED TESTING
WITH PHPUNIT
04
AUTOMATED TESTING
• Prevent regressions!
• More confidence when
making changes
• Built-in specifications
AUTOMATED TESTING
Functional tests
• Test overall behavior and I/O
• Fairly easy to write, even for
existing code
public function testBelongsToMany()
{
$worker = EloquentTestWorker::first();
$worker->jobs()->attach([1,2]);
$this->assertArrayEqual([
[
'id' => 1,
'label' => 'forager',
'pivot' => [
'worker_id' => 1,
'job_id' => 1
]
],
…
], $worker->jobs->toArray());
}
AUTOMATED TESTING
Unit tests
• Test individual methods
• Test both what your methods do
and how they do it
• Harder to write, requires careful
design (design for testability,
inversion of control)
• Often written before the code itself
as a specification (test-driven
development)
• Mockery
public function testSyncMethod($list)
{
$relation = $this->getRelation();
// Simulate determination of related key from builder
$relation->getRelated()->shouldReceive('getKeyName')->once()-
>andReturn('id');
// Simulate fetching of current relationships (1,2,3)
$query = m::mock('stdClass');
$relation->shouldReceive('newQuery')->once()->andReturn($query);
$query->shouldReceive('pluck')->once()->with('id')->andReturn(new
BaseCollection([1, 2, 3]));
// withoutGlobalScopes will get called exactly 3 times
$relation->getRelated()->shouldReceive('withoutGlobalScopes')-
>times(3)->andReturn($query);
// Test deletions of items removed from relationship (1)
$query->shouldReceive('whereIn')->once()->with('id', [1])-
>andReturn($query);
$query->shouldReceive('delete')->once()->andReturn($query);
…
// Check result
$this->assertEquals(['created' => ['x'], 'deleted' => [1],
'updated' => [2,3]], $relation->sync($list));
}
BUILDING AND
DEPLOYMENT
05
BUILDING AND DEPLOYMENT
THANK YOU!

More Related Content

What's hot

기가박스 영화관 운영 시스템 구축마지막
기가박스 영화관 운영 시스템 구축마지막기가박스 영화관 운영 시스템 구축마지막
기가박스 영화관 운영 시스템 구축마지막ssuser5280ce
 
Aplicando o poder de uma GPU no SQL Server
Aplicando o poder de uma GPU noSQL ServerAplicando o poder de uma GPU noSQL Server
Aplicando o poder de uma GPU no SQL Serverpichiliani
 
오픈스택 멀티노드 설치 후기
오픈스택 멀티노드 설치 후기오픈스택 멀티노드 설치 후기
오픈스택 멀티노드 설치 후기영우 김
 
Distributed load testing with k6
Distributed load testing with k6Distributed load testing with k6
Distributed load testing with k6Thijs Feryn
 
The Patterns of Distributed Logging and Containers
The Patterns of Distributed Logging and ContainersThe Patterns of Distributed Logging and Containers
The Patterns of Distributed Logging and ContainersSATOSHI TAGOMORI
 
Issues of OpenStack multi-region mode
Issues of OpenStack multi-region modeIssues of OpenStack multi-region mode
Issues of OpenStack multi-region modeJoe Huang
 
Restoring Restoration's Reputation in Kafka Streams with Bruno Cadonna & Luca...
Restoring Restoration's Reputation in Kafka Streams with Bruno Cadonna & Luca...Restoring Restoration's Reputation in Kafka Streams with Bruno Cadonna & Luca...
Restoring Restoration's Reputation in Kafka Streams with Bruno Cadonna & Luca...HostedbyConfluent
 
Ten reasons to choose Apache Pulsar over Apache Kafka for Event Sourcing_Robe...
Ten reasons to choose Apache Pulsar over Apache Kafka for Event Sourcing_Robe...Ten reasons to choose Apache Pulsar over Apache Kafka for Event Sourcing_Robe...
Ten reasons to choose Apache Pulsar over Apache Kafka for Event Sourcing_Robe...StreamNative
 
【BS9】モダン & クラウドネイティブなソフトウエア開発はじめよう ~ Azure DevOps & GitHub を使ったアプリ開発 DevOps 101
【BS9】モダン & クラウドネイティブなソフトウエア開発はじめよう ~ Azure DevOps & GitHub を使ったアプリ開発 DevOps 101 【BS9】モダン & クラウドネイティブなソフトウエア開発はじめよう ~ Azure DevOps & GitHub を使ったアプリ開発 DevOps 101
【BS9】モダン & クラウドネイティブなソフトウエア開発はじめよう ~ Azure DevOps & GitHub を使ったアプリ開発 DevOps 101 日本マイクロソフト株式会社
 
Disaster Recovery with MirrorMaker 2.0 (Ryanne Dolan, Cloudera) Kafka Summit ...
Disaster Recovery with MirrorMaker 2.0 (Ryanne Dolan, Cloudera) Kafka Summit ...Disaster Recovery with MirrorMaker 2.0 (Ryanne Dolan, Cloudera) Kafka Summit ...
Disaster Recovery with MirrorMaker 2.0 (Ryanne Dolan, Cloudera) Kafka Summit ...confluent
 
Routed Provider Networks on OpenStack
Routed Provider Networks on OpenStack Routed Provider Networks on OpenStack
Routed Provider Networks on OpenStack Romana Project
 
Troubleshooting Kafka's socket server: from incident to resolution
Troubleshooting Kafka's socket server: from incident to resolutionTroubleshooting Kafka's socket server: from incident to resolution
Troubleshooting Kafka's socket server: from incident to resolutionJoel Koshy
 
Red Hat OpenStack 17 저자직강+스터디그룹_1주차
Red Hat OpenStack 17 저자직강+스터디그룹_1주차Red Hat OpenStack 17 저자직강+스터디그룹_1주차
Red Hat OpenStack 17 저자직강+스터디그룹_1주차Nalee Jang
 
Exactly-once Semantics in Apache Kafka
Exactly-once Semantics in Apache KafkaExactly-once Semantics in Apache Kafka
Exactly-once Semantics in Apache Kafkaconfluent
 
Getting up to Speed with MirrorMaker 2 (Mickael Maison, IBM & Ryanne Dolan) K...
Getting up to Speed with MirrorMaker 2 (Mickael Maison, IBM & Ryanne Dolan) K...Getting up to Speed with MirrorMaker 2 (Mickael Maison, IBM & Ryanne Dolan) K...
Getting up to Speed with MirrorMaker 2 (Mickael Maison, IBM & Ryanne Dolan) K...HostedbyConfluent
 
Cruise Control: Effortless management of Kafka clusters
Cruise Control: Effortless management of Kafka clustersCruise Control: Effortless management of Kafka clusters
Cruise Control: Effortless management of Kafka clustersPrateek Maheshwari
 
Postgres Vision 2018: WAL: Everything You Want to Know
Postgres Vision 2018: WAL: Everything You Want to KnowPostgres Vision 2018: WAL: Everything You Want to Know
Postgres Vision 2018: WAL: Everything You Want to KnowEDB
 

What's hot (20)

기가박스 영화관 운영 시스템 구축마지막
기가박스 영화관 운영 시스템 구축마지막기가박스 영화관 운영 시스템 구축마지막
기가박스 영화관 운영 시스템 구축마지막
 
Aplicando o poder de uma GPU no SQL Server
Aplicando o poder de uma GPU noSQL ServerAplicando o poder de uma GPU noSQL Server
Aplicando o poder de uma GPU no SQL Server
 
오픈스택 멀티노드 설치 후기
오픈스택 멀티노드 설치 후기오픈스택 멀티노드 설치 후기
오픈스택 멀티노드 설치 후기
 
Distributed load testing with k6
Distributed load testing with k6Distributed load testing with k6
Distributed load testing with k6
 
The Patterns of Distributed Logging and Containers
The Patterns of Distributed Logging and ContainersThe Patterns of Distributed Logging and Containers
The Patterns of Distributed Logging and Containers
 
Demystifying openvswitch
Demystifying openvswitchDemystifying openvswitch
Demystifying openvswitch
 
Issues of OpenStack multi-region mode
Issues of OpenStack multi-region modeIssues of OpenStack multi-region mode
Issues of OpenStack multi-region mode
 
Restoring Restoration's Reputation in Kafka Streams with Bruno Cadonna & Luca...
Restoring Restoration's Reputation in Kafka Streams with Bruno Cadonna & Luca...Restoring Restoration's Reputation in Kafka Streams with Bruno Cadonna & Luca...
Restoring Restoration's Reputation in Kafka Streams with Bruno Cadonna & Luca...
 
Ten reasons to choose Apache Pulsar over Apache Kafka for Event Sourcing_Robe...
Ten reasons to choose Apache Pulsar over Apache Kafka for Event Sourcing_Robe...Ten reasons to choose Apache Pulsar over Apache Kafka for Event Sourcing_Robe...
Ten reasons to choose Apache Pulsar over Apache Kafka for Event Sourcing_Robe...
 
【BS9】モダン & クラウドネイティブなソフトウエア開発はじめよう ~ Azure DevOps & GitHub を使ったアプリ開発 DevOps 101
【BS9】モダン & クラウドネイティブなソフトウエア開発はじめよう ~ Azure DevOps & GitHub を使ったアプリ開発 DevOps 101 【BS9】モダン & クラウドネイティブなソフトウエア開発はじめよう ~ Azure DevOps & GitHub を使ったアプリ開発 DevOps 101
【BS9】モダン & クラウドネイティブなソフトウエア開発はじめよう ~ Azure DevOps & GitHub を使ったアプリ開発 DevOps 101
 
Disaster Recovery with MirrorMaker 2.0 (Ryanne Dolan, Cloudera) Kafka Summit ...
Disaster Recovery with MirrorMaker 2.0 (Ryanne Dolan, Cloudera) Kafka Summit ...Disaster Recovery with MirrorMaker 2.0 (Ryanne Dolan, Cloudera) Kafka Summit ...
Disaster Recovery with MirrorMaker 2.0 (Ryanne Dolan, Cloudera) Kafka Summit ...
 
Deploying IPv6 on OpenStack
Deploying IPv6 on OpenStackDeploying IPv6 on OpenStack
Deploying IPv6 on OpenStack
 
Mono Repo
Mono RepoMono Repo
Mono Repo
 
Routed Provider Networks on OpenStack
Routed Provider Networks on OpenStack Routed Provider Networks on OpenStack
Routed Provider Networks on OpenStack
 
Troubleshooting Kafka's socket server: from incident to resolution
Troubleshooting Kafka's socket server: from incident to resolutionTroubleshooting Kafka's socket server: from incident to resolution
Troubleshooting Kafka's socket server: from incident to resolution
 
Red Hat OpenStack 17 저자직강+스터디그룹_1주차
Red Hat OpenStack 17 저자직강+스터디그룹_1주차Red Hat OpenStack 17 저자직강+스터디그룹_1주차
Red Hat OpenStack 17 저자직강+스터디그룹_1주차
 
Exactly-once Semantics in Apache Kafka
Exactly-once Semantics in Apache KafkaExactly-once Semantics in Apache Kafka
Exactly-once Semantics in Apache Kafka
 
Getting up to Speed with MirrorMaker 2 (Mickael Maison, IBM & Ryanne Dolan) K...
Getting up to Speed with MirrorMaker 2 (Mickael Maison, IBM & Ryanne Dolan) K...Getting up to Speed with MirrorMaker 2 (Mickael Maison, IBM & Ryanne Dolan) K...
Getting up to Speed with MirrorMaker 2 (Mickael Maison, IBM & Ryanne Dolan) K...
 
Cruise Control: Effortless management of Kafka clusters
Cruise Control: Effortless management of Kafka clustersCruise Control: Effortless management of Kafka clusters
Cruise Control: Effortless management of Kafka clusters
 
Postgres Vision 2018: WAL: Everything You Want to Know
Postgres Vision 2018: WAL: Everything You Want to KnowPostgres Vision 2018: WAL: Everything You Want to Know
Postgres Vision 2018: WAL: Everything You Want to Know
 

Viewers also liked

Hacking Laravel - Custom Relationships with Eloquent
Hacking Laravel - Custom Relationships with EloquentHacking Laravel - Custom Relationships with Eloquent
Hacking Laravel - Custom Relationships with EloquentAlex Weissman
 
Web Performance 2017: Myths and Truths (php[world] 2017)
Web Performance 2017: Myths and Truths (php[world] 2017)Web Performance 2017: Myths and Truths (php[world] 2017)
Web Performance 2017: Myths and Truths (php[world] 2017)Christian Wenz
 
Developing applications for performance
Developing applications for performanceDeveloping applications for performance
Developing applications for performanceLeon Fayer
 
Inheritance: Vertical or Horizontal
Inheritance: Vertical or HorizontalInheritance: Vertical or Horizontal
Inheritance: Vertical or HorizontalMark Niebergall
 
Create a PHP Library the right way
Create a PHP Library the right wayCreate a PHP Library the right way
Create a PHP Library the right wayChristian Varela
 
Leveraging a distributed architecture to your advantage
Leveraging a distributed architecture to your advantageLeveraging a distributed architecture to your advantage
Leveraging a distributed architecture to your advantageMichelangelo van Dam
 
Webpack Encore Symfony Live 2017 San Francisco
Webpack Encore Symfony Live 2017 San FranciscoWebpack Encore Symfony Live 2017 San Francisco
Webpack Encore Symfony Live 2017 San FranciscoRyan Weaver
 
A Journey from Hexagonal Architecture to Event Sourcing - SymfonyCon Cluj 2017
A Journey from Hexagonal Architecture to Event Sourcing - SymfonyCon Cluj 2017A Journey from Hexagonal Architecture to Event Sourcing - SymfonyCon Cluj 2017
A Journey from Hexagonal Architecture to Event Sourcing - SymfonyCon Cluj 2017Carlos Buenosvinos
 
Advanced MySQL Query Optimizations
Advanced MySQL Query OptimizationsAdvanced MySQL Query Optimizations
Advanced MySQL Query OptimizationsDave Stokes
 
MySQL 8.0 Preview: What Is Coming?
MySQL 8.0 Preview: What Is Coming?MySQL 8.0 Preview: What Is Coming?
MySQL 8.0 Preview: What Is Coming?Gabriela Ferrara
 

Viewers also liked (10)

Hacking Laravel - Custom Relationships with Eloquent
Hacking Laravel - Custom Relationships with EloquentHacking Laravel - Custom Relationships with Eloquent
Hacking Laravel - Custom Relationships with Eloquent
 
Web Performance 2017: Myths and Truths (php[world] 2017)
Web Performance 2017: Myths and Truths (php[world] 2017)Web Performance 2017: Myths and Truths (php[world] 2017)
Web Performance 2017: Myths and Truths (php[world] 2017)
 
Developing applications for performance
Developing applications for performanceDeveloping applications for performance
Developing applications for performance
 
Inheritance: Vertical or Horizontal
Inheritance: Vertical or HorizontalInheritance: Vertical or Horizontal
Inheritance: Vertical or Horizontal
 
Create a PHP Library the right way
Create a PHP Library the right wayCreate a PHP Library the right way
Create a PHP Library the right way
 
Leveraging a distributed architecture to your advantage
Leveraging a distributed architecture to your advantageLeveraging a distributed architecture to your advantage
Leveraging a distributed architecture to your advantage
 
Webpack Encore Symfony Live 2017 San Francisco
Webpack Encore Symfony Live 2017 San FranciscoWebpack Encore Symfony Live 2017 San Francisco
Webpack Encore Symfony Live 2017 San Francisco
 
A Journey from Hexagonal Architecture to Event Sourcing - SymfonyCon Cluj 2017
A Journey from Hexagonal Architecture to Event Sourcing - SymfonyCon Cluj 2017A Journey from Hexagonal Architecture to Event Sourcing - SymfonyCon Cluj 2017
A Journey from Hexagonal Architecture to Event Sourcing - SymfonyCon Cluj 2017
 
Advanced MySQL Query Optimizations
Advanced MySQL Query OptimizationsAdvanced MySQL Query Optimizations
Advanced MySQL Query Optimizations
 
MySQL 8.0 Preview: What Is Coming?
MySQL 8.0 Preview: What Is Coming?MySQL 8.0 Preview: What Is Coming?
MySQL 8.0 Preview: What Is Coming?
 

Similar to Essential Tools for Modern PHP Development

Development Setup of B-Translator
Development Setup of B-TranslatorDevelopment Setup of B-Translator
Development Setup of B-TranslatorDashamir Hoxha
 
Build Great Networked APIs with Swift, OpenAPI, and gRPC
Build Great Networked APIs with Swift, OpenAPI, and gRPCBuild Great Networked APIs with Swift, OpenAPI, and gRPC
Build Great Networked APIs with Swift, OpenAPI, and gRPCTim Burks
 
Nt1310 Unit 3 Language Analysis
Nt1310 Unit 3 Language AnalysisNt1310 Unit 3 Language Analysis
Nt1310 Unit 3 Language AnalysisNicole Gomez
 
Jbossworld Presentation
Jbossworld PresentationJbossworld Presentation
Jbossworld PresentationDan Hinojosa
 
Php Dependency Management with Composer ZendCon 2017
Php Dependency Management with Composer ZendCon 2017Php Dependency Management with Composer ZendCon 2017
Php Dependency Management with Composer ZendCon 2017Clark Everetts
 
How to Build a Custom Plugin in Rundeck
How to Build a Custom Plugin in RundeckHow to Build a Custom Plugin in Rundeck
How to Build a Custom Plugin in RundeckRundeck
 
The DevOps paradigm - the evolution of IT professionals and opensource toolkit
The DevOps paradigm - the evolution of IT professionals and opensource toolkitThe DevOps paradigm - the evolution of IT professionals and opensource toolkit
The DevOps paradigm - the evolution of IT professionals and opensource toolkitMarco Ferrigno
 
The DevOps Paradigm
The DevOps ParadigmThe DevOps Paradigm
The DevOps ParadigmNaLUG
 
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...Pantheon
 
Gerrit linuxtag2011
Gerrit linuxtag2011Gerrit linuxtag2011
Gerrit linuxtag2011thkoch
 
AD113 Speed Up Your Applications w/ Nginx and PageSpeed
AD113  Speed Up Your Applications w/ Nginx and PageSpeedAD113  Speed Up Your Applications w/ Nginx and PageSpeed
AD113 Speed Up Your Applications w/ Nginx and PageSpeededm00se
 
Rails Rookies Bootcamp - Blogger
Rails Rookies Bootcamp - BloggerRails Rookies Bootcamp - Blogger
Rails Rookies Bootcamp - BloggerNathanial McConnell
 
Managing software product versioning with Gitflow, VSTS and Atlassian SourceTree
Managing software product versioning with Gitflow, VSTS and Atlassian SourceTreeManaging software product versioning with Gitflow, VSTS and Atlassian SourceTree
Managing software product versioning with Gitflow, VSTS and Atlassian SourceTreeBosnia Agile
 
Going open source with small teams
Going open source with small teamsGoing open source with small teams
Going open source with small teamsJamie Thomas
 
Lean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and DrushLean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and DrushPantheon
 

Similar to Essential Tools for Modern PHP Development (20)

Development Setup of B-Translator
Development Setup of B-TranslatorDevelopment Setup of B-Translator
Development Setup of B-Translator
 
Build Great Networked APIs with Swift, OpenAPI, and gRPC
Build Great Networked APIs with Swift, OpenAPI, and gRPCBuild Great Networked APIs with Swift, OpenAPI, and gRPC
Build Great Networked APIs with Swift, OpenAPI, and gRPC
 
Nt1310 Unit 3 Language Analysis
Nt1310 Unit 3 Language AnalysisNt1310 Unit 3 Language Analysis
Nt1310 Unit 3 Language Analysis
 
My Saminar On Php
My Saminar On PhpMy Saminar On Php
My Saminar On Php
 
Jbossworld Presentation
Jbossworld PresentationJbossworld Presentation
Jbossworld Presentation
 
Php Dependency Management with Composer ZendCon 2017
Php Dependency Management with Composer ZendCon 2017Php Dependency Management with Composer ZendCon 2017
Php Dependency Management with Composer ZendCon 2017
 
An intro to git
An intro to gitAn intro to git
An intro to git
 
How to Build a Custom Plugin in Rundeck
How to Build a Custom Plugin in RundeckHow to Build a Custom Plugin in Rundeck
How to Build a Custom Plugin in Rundeck
 
The DevOps paradigm - the evolution of IT professionals and opensource toolkit
The DevOps paradigm - the evolution of IT professionals and opensource toolkitThe DevOps paradigm - the evolution of IT professionals and opensource toolkit
The DevOps paradigm - the evolution of IT professionals and opensource toolkit
 
The DevOps Paradigm
The DevOps ParadigmThe DevOps Paradigm
The DevOps Paradigm
 
Open event presentation.3 2
Open event presentation.3 2Open event presentation.3 2
Open event presentation.3 2
 
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
 
Best practices tekx
Best practices tekxBest practices tekx
Best practices tekx
 
Gerrit linuxtag2011
Gerrit linuxtag2011Gerrit linuxtag2011
Gerrit linuxtag2011
 
AD113 Speed Up Your Applications w/ Nginx and PageSpeed
AD113  Speed Up Your Applications w/ Nginx and PageSpeedAD113  Speed Up Your Applications w/ Nginx and PageSpeed
AD113 Speed Up Your Applications w/ Nginx and PageSpeed
 
AtoZ about TYPO3 v8 CMS
AtoZ about TYPO3 v8 CMSAtoZ about TYPO3 v8 CMS
AtoZ about TYPO3 v8 CMS
 
Rails Rookies Bootcamp - Blogger
Rails Rookies Bootcamp - BloggerRails Rookies Bootcamp - Blogger
Rails Rookies Bootcamp - Blogger
 
Managing software product versioning with Gitflow, VSTS and Atlassian SourceTree
Managing software product versioning with Gitflow, VSTS and Atlassian SourceTreeManaging software product versioning with Gitflow, VSTS and Atlassian SourceTree
Managing software product versioning with Gitflow, VSTS and Atlassian SourceTree
 
Going open source with small teams
Going open source with small teamsGoing open source with small teams
Going open source with small teams
 
Lean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and DrushLean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and Drush
 

Recently uploaded

FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607dollysharma2066
 
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...Sheetaleventcompany
 
VIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
VIP Kolkata Call Girls Salt Lake 8250192130 Available With RoomVIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
VIP Kolkata Call Girls Salt Lake 8250192130 Available With Roomgirls4nights
 
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...aditipandeya
 
Russian Call girls in Dubai +971563133746 Dubai Call girls
Russian  Call girls in Dubai +971563133746 Dubai  Call girlsRussian  Call girls in Dubai +971563133746 Dubai  Call girls
Russian Call girls in Dubai +971563133746 Dubai Call girlsstephieert
 
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call GirlVIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girladitipandeya
 
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls KolkataLow Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts servicevipmodelshub1
 
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$kojalkojal131
 
On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024APNIC
 
Radiant Call girls in Dubai O56338O268 Dubai Call girls
Radiant Call girls in Dubai O56338O268 Dubai Call girlsRadiant Call girls in Dubai O56338O268 Dubai Call girls
Radiant Call girls in Dubai O56338O268 Dubai Call girlsstephieert
 
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...SofiyaSharma5
 
VIP Call Girls Pune Madhuri 8617697112 Independent Escort Service Pune
VIP Call Girls Pune Madhuri 8617697112 Independent Escort Service PuneVIP Call Girls Pune Madhuri 8617697112 Independent Escort Service Pune
VIP Call Girls Pune Madhuri 8617697112 Independent Escort Service PuneCall girls in Ahmedabad High profile
 
Challengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya Shirtrahman018755
 
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts servicesonalikaur4
 
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsAlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsThierry TROUIN ☁
 
Networking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGNetworking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGAPNIC
 

Recently uploaded (20)

Call Girls In South Ex 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
Call Girls In South Ex 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICECall Girls In South Ex 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
Call Girls In South Ex 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
 
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
 
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
 
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
 
VIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
VIP Kolkata Call Girls Salt Lake 8250192130 Available With RoomVIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
VIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
 
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
 
Russian Call girls in Dubai +971563133746 Dubai Call girls
Russian  Call girls in Dubai +971563133746 Dubai  Call girlsRussian  Call girls in Dubai +971563133746 Dubai  Call girls
Russian Call girls in Dubai +971563133746 Dubai Call girls
 
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call GirlVIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
 
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls KolkataLow Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
 
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
 
On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024
 
Radiant Call girls in Dubai O56338O268 Dubai Call girls
Radiant Call girls in Dubai O56338O268 Dubai Call girlsRadiant Call girls in Dubai O56338O268 Dubai Call girls
Radiant Call girls in Dubai O56338O268 Dubai Call girls
 
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
 
VIP Call Girls Pune Madhuri 8617697112 Independent Escort Service Pune
VIP Call Girls Pune Madhuri 8617697112 Independent Escort Service PuneVIP Call Girls Pune Madhuri 8617697112 Independent Escort Service Pune
VIP Call Girls Pune Madhuri 8617697112 Independent Escort Service Pune
 
Challengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya Shirt
 
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
 
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsAlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with Flows
 
Networking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGNetworking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOG
 

Essential Tools for Modern PHP Development

  • 1. Place your screenshot here Essential Tools for Modern PHP Alex Weissman GIT PSR Composer NODE.JS PHP UNIT PHP DOC MARKDOWN
  • 2. Fred Brooks, The Mythical Man-Month We learn how to make this in school (or at home) But this is what we're building in the "real world"
  • 3. Git Version control system, the basis for Github. Stores snapshots, enhances collaboration. Composer A dependency manager for PHP. Node.js An open-source cross- platform runtime environment, helps with asset management and deployment. Node Package Manager, npm, is its dependency manager. PSR Coding standards for PHP that include formatting, syntax, best practices and interoperability. PHP Unit Essential tool for creating and running automated tests. PHP Doc Standards for low-level documentation (comments) in your code base. Overview Essential Tools Markdown A language for formatting plain text. Makes communication easier.
  • 4. What is the main job of a software developer?
  • 5. The ratio of time spent reading versus writing is well over 10 to 1. We are constantly reading old code as part of the effort to write new code. ...[Therefore,] making it easy to read makes it easier to write. ― Robert C. Martin, Clean Code: A Handbook of Agile Software Craftsmanship
  • 7. MARKDOWN ● The format for writing readable content (especially code) on the web ● Alternative to allowing people to enter HTML, which: ○ Is more verbose and takes longer to write; ○ Requires special handling to prevent XSS attacks
  • 10. PHPDOC ● Document each file, class, member variable, and method with a DocBlock ● DocBlocks contain both free text descriptions and structured metadata (tags) ● DocBlocks can be automatically parsed by: ○ Text editors and IDEs for type-hinting and code completion; ○ Standalone tools to generate API documentation /** * A BelongsToMany relationship that supports ternary (three-way) pivot relationships. * * @author Alex Weissman (https://alexanderweissman.com) * @link https://github.com/laravel/framework/ */ class BelongsToTernary extends BelongsToMany { … }
  • 12. CODING STYLE PHP Standards Recommendations (PSRs): PSR-1 and PSR-2
  • 13. CODING STYLE usrefrostieng is a web framework for php but other web framework offers a compleate toolbox of pogram modules for build app.its a fully-functioning user managment ap unlike other php famework right out of the box and full extandable so that you can easly create the custom feature userfroasting design hellp new and return devlopers up to speed at modern php so youll be comfortably intoduce to COMPOSER and PSR for better structure ur code and easy manage when you'll learn use node and Bower to cleanly manage client- side packages (JAVASCRIPT and CSS) UserFrosting is a web framework for PHP. Like other web frameworks, it offers a complete toolbox of programmatic components for building your application. Unlike other PHP frameworks, it's a fully-functioning user management application, right out of the box. And, it's fully extendable so that you can easily create the custom features you need. UserFrosting is designed to bring new and returning developers up to speed with the modern PHP community. You'll be comfortably introduced to Composer (the dependency manager), object-oriented design patterns, and the PHP Standards Recommendations (PSR), making your code better structured and easier to manage. What's more, you'll learn how to use Node.js and Bower to cleanly manage client-side packages (Javascript and CSS). Transform yourself from a code monkey into a software engineer.
  • 14. CODING STYLE class loggedInUser { public $email = NULL; public $hash_pw = NULL; public $user_id = NULL; public $csrf_token = NULL; // Simple function to update the last sign in of a user public function updateLastSignIn() { updateUserLastSignIn($this->user_id); } // Return the timestamp when this user's account was registered public function signupTimeStamp(){ return fetchUserField($this->user_id, 'sign_up_stamp'); } //csrf tokens public function csrf_token($regen = false) { if($regen === true) { //*make sure token is set, if so unset*// if(isset($_SESSION["__csrf_token"])) { unset($_SESSION["__csrf_token"]); } if (function_exists('openssl_random_pseudo_bytes')) { $rand_num = openssl_random_pseudo_bytes(16);//pull 16 bytes from /dev/random }else{
  • 15. CODING STYLE namespace AppModel; class LoggedInUser { public $id = NULL; public $email = NULL; public $password = NULL; public $csrfToken = NULL; /** * Update the last sign in time of a user * * @return AppModelLoggedInUser */ public function updateLastSignIn() { $this->updateField('last_sign_in'); return $this; } /** * Return the timestamp for when this user's account was registered * * @return string */ public function signupTimeStamp() { return $this->fetchField('sign_up_stamp'); } }
  • 16. PSR-1 and PSR-2 ● Don’t use ?> ● 4 spaces for indentation ○ DON’T use tabs ○ DO configure your text editor to write 4 spaces when you press tab ● One statement; ● Per line; ● Control structures: opening brace on same line ● This code snippet encompasses a lot of the other formatting rules: if ($a === $b) { bar(); } elseif ($a > $b) { $foo->bar($arg1); } else { BazClass::bar($arg2, $arg3); }
  • 17. <?php /** * Owl Fancy * * @link https://owlfancy.com * @license All rights reserved */ namespace AppModels; use AppMailMailer; class Member { /** * Email member with reminder to renew subscription. * * @param AppMailContact $senderInfo * @param string $params * @return string */ public function sendSubscriptionReminder($senderInfo, $params) { $message = new Mailer($senderInfo, $this->email); return $message->render('bill-reminder.html.twig', $params); } ... } Object-oriented programming • Namespaces! • Stricter naming conventions for classes, methods • One class per file! • Separation of concerns. Avoid side effects - A file should either define symbols OR perform logic/render content PSR-1 and PSR-2
  • 18. PSR’s don’t have rules for everything, but you should Be consistent, even if PSR's do not provide a specific requirement! • Variables - choose a style like camelCase; • Functions - camelCase; • Array keys - snake_case; • Double vs single quotes - single quotes when double aren’t necessary • Naming conventions – create vs createUser vs userCreate
  • 20. WHAT IS VERSION CONTROL? Version control systems are a category of software tools that help a software team manage changes to source code over time. - Atlassian, Git Tutorial
  • 22. ● What has been changed from one version to the next? ● Who made those changes, and why? ● How can I integrate changes that have been made by multiple developers in a non-blocking way? ● Finding specific changes and stepping back to previous states? ● I'd like to do these things efficiently and automatically. A tool that solves...
  • 23. Life after version control • I know who did what and when. • I can easily see what has changed. • Commit messages summarize changes. • Collaboration with team members and the open source community. • I can use it for deployment.
  • 24. How git works The working tree is my code, as it stands right now. A change is adding, modifying, or deleting a line of code in my working tree. A commit is a set of changes made by a specific person at a specific point in time. The repository is the current working tree together with its commit history and various references to specific commits. This is all happening locally, on your machine.
  • 25. ANATOMY OF A GIT REPOSITORY alexw @ 2017-01-01 03:05:49 Fix directory traversal vulnerability 3 lines added, 4 changed, 2 removed alexw @ 2017-01-01 22:11:17 Fix directory traversal vulnerability for real this time 7 lines changed sarah @ 2017-01-04 11:17:10 Improve Alex's terrible CSS 4 lines changed, 3 removed HEAD
  • 26. alexw @ 2017-01-01 03:05:49 Fix directory traversal vulnerability 3 lines added, 4 changed, 2 removed alexw @ 2017-01-01 22:11:17 Fix directory traversal vulnerability for real this time 7 lines changed sarah @ 2017-01-04 11:17:10 Improve Alex's terrible CSS 4 lines changed, 3 removed HEAD site/ ├── config/ └── default.php ├── src/ └── composer.json alexw @ 2017-01-05 23:18:01 Turn off debugging in config 2 lines changed, 1 removed site/ ├── config/ └── default.php ├── src/ └── composer.json commit stage working tree commit history older commits ANATOMY OF A GIT REPOSITORY
  • 27. Remotes ● A remote refers to an authoritative version of the project on a server. ● Github offers public remote repositories for free. ● For private repos, use Bitbucket for free, run your own git server, or get a paid Github account. ● git clone creates a new user’s local copy of the project, with the full history ● git push adds a user’s local commits to the repository ● git pull adds other team member’s changes to a user’s local copy ● Git uses various strategies to deal with complex changes. These are fetch and merge strategies, and learn about these in an advanced course. Merge conflicts can be manually resolved where needed.
  • 28. Branches ● git branch creates an alternative timeline for experimental features, bugfixes, and divergent ideas. ● Branches can be merged or discarded as needed. ● git checkout allows you to switch between branches
  • 29. GIT
  • 31. COMPOSER ● The dependency (package) management tool for PHP since 2012 ● Downloads and installs packages from packagist.org ● Automatically resolves dependency graphs ● Designed in conjunction with PSR-4 (autoloading)
  • 32. <?php error_reporting (E_ALL ^ E_WARNING); require('./class_definitions.inc'); require('./user_profiles.inc'); require('./file_submission.inc'); require('configurator_object.inc'); $configurators = array(); require('load_objects.inc'); unset($configurators); session_start(); <?php require_once __DIR__ . '/../vendor/autoload.php';
  • 33. COMPOSER { "name": "userfrosting/userfrosting", "require": { "pimple/pimple": "~3.1.0", "slim/slim": ”^3.0" }, "autoload": { "psr-4": { "UserFrostingSprinkleCore": "src/" } } } composer.json $ composer install $ composer update
  • 36. COMPOSER vendor/ ├── pimple/pimple 3.1.2 ├── slimphp/slim 3.9 └── psr/container 1.0 hey man you see that package over there he doesn’t use semantic versioning
  • 39. AUTOMATED TESTING • Prevent regressions! • More confidence when making changes • Built-in specifications
  • 40. AUTOMATED TESTING Functional tests • Test overall behavior and I/O • Fairly easy to write, even for existing code public function testBelongsToMany() { $worker = EloquentTestWorker::first(); $worker->jobs()->attach([1,2]); $this->assertArrayEqual([ [ 'id' => 1, 'label' => 'forager', 'pivot' => [ 'worker_id' => 1, 'job_id' => 1 ] ], … ], $worker->jobs->toArray()); }
  • 41. AUTOMATED TESTING Unit tests • Test individual methods • Test both what your methods do and how they do it • Harder to write, requires careful design (design for testability, inversion of control) • Often written before the code itself as a specification (test-driven development) • Mockery public function testSyncMethod($list) { $relation = $this->getRelation(); // Simulate determination of related key from builder $relation->getRelated()->shouldReceive('getKeyName')->once()- >andReturn('id'); // Simulate fetching of current relationships (1,2,3) $query = m::mock('stdClass'); $relation->shouldReceive('newQuery')->once()->andReturn($query); $query->shouldReceive('pluck')->once()->with('id')->andReturn(new BaseCollection([1, 2, 3])); // withoutGlobalScopes will get called exactly 3 times $relation->getRelated()->shouldReceive('withoutGlobalScopes')- >times(3)->andReturn($query); // Test deletions of items removed from relationship (1) $query->shouldReceive('whereIn')->once()->with('id', [1])- >andReturn($query); $query->shouldReceive('delete')->once()->andReturn($query); … // Check result $this->assertEquals(['created' => ['x'], 'deleted' => [1], 'updated' => [2,3]], $relation->sync($list)); }

Editor's Notes

  1. Some of these are not actually PHP. And some of these are not actually tools, in the conventional sense.
  2. The principal task of the software developer is to read (not write) code.
  3. Not going to cover everything, but particularly important are inline- and block code snippets
  4. How many of you have heard of the PHP Standards Recommendations? PHP Framework Interop Group – stress interop.
  5. PHP has a very flexible syntax - why should we make up arbitrary rules?
  6. PHP has a very flexible syntax - why should we make up arbitrary rules?
  7. PHP has a very flexible syntax - why should we make up arbitrary rules?
  8. Create your own internal documents!
  9. This was my "version control" - what are some of the problems here?
  10. Avoid "not invented here" syndrome
  11. Up until March of 2012, PHP didn't really have a good project-level package manager. There was PEAR, but it failed to keep up with the evolution of the PHP community. In March of 2012, on the heels of the PHP Standard Recommendations (PSR) project, Composer was released and a new era of PHP began. If you've been out of the PHP world for a while, you might have missed this critical shift. Over the past few years, Composer has risen to become the de facto package manager for PHP, with Packagist as its main public package repository. This means that the best way to incorporate third-party code (which you definitely should do) is by installing and using Composer - at the very least, in your development environment.
  12. Composer also handles autoloading, which means that the days of needing long blocks of include or require statements in your code are over. It fully implements the PSR-4 standard for autoloading, which further helps the PHP community develop a consistent approach to releasing and consuming packages.