25
Current status of PSR PHP BLT #1

Current status of PSR - Phpblt1

Embed Size (px)

Citation preview

Current status of PSR

PHP BLT #1

@yui_tang / Yui Sakamoto

• Software Engineer @ Mercari, Inc.

• I was server-side engineer…

• But, I’m writing JavaScript…

• 推し松は十四松です。

What’s PSRPHP Standards Recommendations• 直訳するとPHP標準勧告 • どうにでも自由に書けちゃうテンプレートエンジンに、秩序を与える。

• 当然、言語側には何の強制力も無い • 本当に大事なことはプロダクト。その他の瑣末なことに気を使う時間を極力減らす為に存在。

PHP-FIG

• “PHP Framework In Group”

• フレームワークの相互運用性について議論するグループ

• その為にPSRを策定・発表

Accepted• PSR-0 Autoloading Standard

• PSR-1 Basic Coding Standard

• PSR-2 Coding Style Guide

• PSR-3 Logger Interface

• PSR-4 Autoloading Standard

• PSR-7 HTTP Message Interface

Review

• PSR-6 Caching Interface

https://github.com/php-fig/fig-standards/blob/master/proposed/cache.md

Draft• PSR-5 PHPDoc Standard

• PSR-8 Huggable Interface

• PSR-9 Security Disclosure

• PSR-10 Security Advisories

• PSR-11 Container Interface

• PSR-12 Extended Coding Style Guide

Review flow

Stages

1. Pre-Draft 提案段階、当然まだ番号は振られない。

2. Draft PSR-XXの番号が振られる。

3. Review PHP-FIGメンバーの投票段階

4. Accepted 正式なPSRとして認められる

Introducing Drafts

PSR-9 Security Disclosure “The main goal of the PSR-9 standard is to provide

structure around the documentation a project provides to the wider community around security

vulnerabilities that have been found (and fixed) and those that are still pending.”

Introducing Drafts

PSR-10 Security Advisories “The goal of this PSR is to give researchers,

project leads, upstream project leads and end users a defined and structured process for

disclosing security vulnerabilities.”

• PSR-9 セキュリティ勧告の報告基準

• PSR-10 レポートの発見を容易にするために、セキュリティの開示ワークフロー

• 要約、公開された日付、より多くの情報とユニークな参照IDへのリンクが含まれ、それぞれの脆弱性のエントリ

• CWEおよび/またはCVE情報、可能であれば(すべてではない脆弱性のCVEとして報告されます)

• どのバージョンの問題が影響

• 問題の現状

• 解決した場合、修復の説明

• プロジェクトのユーザーへの影響に基づいて、低/中/高深刻度

“http://blog.phpdeveloper.org/2015/05/22/php-security-psr-9psr-10/“

Introducing Drafts

PSR-11 Container Interface “The goal set by ContainerInterface is to

standardize how frameworks and libraries make use of a container to obtain objects and

parameters (called entries in the rest of this document).”

The following projects already implement the container-interop version of the interface and therefore would be willing to switch to a Container PSR as soon as it is available.

Projects implementing ContainerInterface

• Acclimate: Adapters for Aura.Di, Laravel, Nette DI, Pimple, Symfony DI, ZF2 Service manager, ZF2 Dependency injection and any container using ArrayAccess

• Aura.DI (v3+)

• dcp-di

• Mouf

• Njasm Container

• PHP-DI

• PimpleInterop

• XStatic

Projects implementing the delegate lookup feature

• Aura.DI

• Mouf

• PHP-DI

• PimpleInterop

• Middlewares implementing ContainerInterface

Introducing Drafts

PSR-12 Extended Coding Style Guide

“This guide extends and expands on PSR-2, the coding style guide and PSR-1, the basic coding

standard.”

• Keywords and True/False/Null

“PHP keywords MUST be in lower case.

The PHP reserved words int, true, object, float, false, mixed, bool, null, numeric, string and resource MUST be in lower case”

• Strict Types, Namespace, and Use Declarations• When present, there MUST be one blank line after the declare declaration.

• When present, there MUST be one blank line after the namespace declaration.

• When present, the namespace declaration MUST go after the declare declaration.

• When present, all use declarations MUST go after the namespace declaration.

• There MUST be one use keyword per declaration.

• Using traits

• abstract, final, and static

• Method and Function Calls

• Closures

• try, catch, finally

• Anonymous Classes

How to commit

PHP Framework Interoperability Group

https://groups.google.com/forum/?fromgroups#!forum/php-fig

参考 • PHP-FIG

http://www.php-fig.org/

• PHP FIG mailing list https://groups.google.com/forum/#!forum/php-fig

• PHP - 憂鬱な希望としての PSR-7 http://sasezaki.hatenablog.com/entry/2015/03/07/195908

• PSR-3 Logger Interfaceのご紹介 http://www.slideshare.net/hinakano/psr-3loggerinterface

ご清聴ありがとうございました。