59
Development with PHP THE RIGHT WAY

Development with PHP | the right way

Embed Size (px)

Citation preview

Development with PHP

Development with PHPThe right way

1

Nahid Bin AzharSoftware Engineer & Laravel Ninja @ ThemeBucketFounder of codesumhttp://nahid.co

What is PHP?

Development with PHP

What is PHP?PHP - Rasmus Lerdorf PHP PHP:Hypertext Preprocessor PHP

PHP ?

PHP Open Source PHP Procedural Programming Object Oriented Programming Documentation

Hmm, do you mean PHP is so awesome?

, PHP Awesome Awesome

String

StringPHP string single quote , double quote string PHP string array substr, strlen, strpos

Array

ArrayPHP array collection, list, stack, queue Array key value PHP Array Multi Dimensional array in_array, array_keys, array_map

If Conditions

If ConditionsProgramming if if endif Ternary Operator Shorten If

Loop

Loop PHP , . for . while array collection of data foreach

Function

FunctionFunction reusable code block

PHP builtin http://php.net/manual/en/indexes.functions.php

Yeh, its really cool

, PHP Development ?

, Way

PHP latest stable Unix-like IDE PHPStorm(Paid), Aptana, Atom, Sublime Text(Paid)(LAMP/LEMP/MAMP) Stack

,

Coding Style

PSR-2PSR-2 Framework Interop Group PHP Community Laravel, Symphony, Silex, Slim, YiiCoding Style Guide

PSR-2Coding Style GuidePSR-2 Coding Style Guide https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md

Object Oriented Programming

OOPOOP : , Object Oriented Programming

Namespacing

NamespaceNamespace file Virtual path PHP

Namespace class

Imaginary Path

Class

ClassOOP class , class Class Class Class

class , Studly Case

Classify Your Code

Encapsulate Your Code

Encapsulation PHP Visibility public, protected privateVisibility Method Properties Class

Making Code Visibility

PHP Dependency Manager

DependencyDependency Manager

Manager

Composer

ComposerComposer PHP Dependency Manager Packagist composer default So, Dont Repeat Yourself (DRY)

The Dependency Manager

Sanitize, Validate & Escape

Data SecurityUser Sanitize User HTML, JS, MySQLHTML character sanitize PHP htmlentities

Sanitize, Validate & EscapeSanitize

Data SecuritySanitize Validate Validate Validate email , Validation

Sanitize, Validate & EscapeValidate

Data SecurityEscape Sanitize Sanitize check Escape filter

Sanitize, Validate & EscapeEscape

Versioning Your Project

Versioning changelog Git Mercurial Version Control Tool

Using Version Control

Test Your Code

Testing TestingPHP Testing Framework UnitTest TestCase

Writing Test Case

Dude

,

Choose The Right Framework

Frameworks Laravel, Symphony, Yii, Zend, CodeIgniter, Silex, Slim Framework

Finally You May Follow Those Guys

You May FollowMatt StaufferAndrew SmithSebastian BergmannGraham CampbellRasmus LerdorfHasin HayderMatt StaufferTaylor OtwellJeffrey Way

Read This Bookshttp://phpcheatsheets.com/https://www.owasp.org/index.php/PHP_Security_Cheat_Sheethttps://phpbestpractices.org/https://www.airpair.com/php/posts/best-practices-for-modern-php-developmenthttp://blog.phpdeveloper.org/http://teamtreehouse.com/library/standards-and-best-practiceshttp://www.pluralsight.com/search/?searchTerm=phphttps://leanpub.com/phptherightway/

You May Read My Diaryhttp://nahid.co/diary

Any Questions?

Thank You Guys