php-annotated-monthly-june-2019

Php_annotated_monthly 이미지

JetBrains에서 제공하는 월간 PHP Annotated Monthly 6월호입니다.

이 중에서 몇 가지 제 취향껏 골라 그 안의 내용도 좀 뒤져보고 개발새발 번역해서 소개합니다.


News & Releases

PHP 7.4.0 alpha 1

https://www.php.net/archive/2019.php#id2019-06-13-1

PHP 7.4의 첫 알파 버전이 나왔습니다. 6개월 간의 pre-release 단계를 시작하는데, 마지막 단계인 GA는 11월 말에 예정되어 있습니다. 정식 버전은 12월일 것으로 예상합니다.

7.4에 관한 overview는 What’s new in PHP 7.4에서 보거나 Nikita Popov가 PHP Russia에서 발표한 동영상을 보셔도 좋습니다.

Doctrine Company, LLC

https://www.doctrine-project.org/2019/05/21/monetizing-open-source.html

10년 간 Doctrine을 오픈 소스로 이끌었던 팀이 재정적으로 지속 가능하게하기 위한 목적으로 회사를 설립했습니다. 이제 프로젝트를 공식적으로 후원하거나 교육 또는 컨설팅을 요청하거나 웹 세미나에 참여할 수 있습니다…만 좀 멀죠.

Bref is now backed by null, the company

https://mnapoli.fr/bref-is-backed-by-null/

Serverless PHP app을 만드는데 도움을 주는 Bref가 null이라는 회사의 지원을 받는다(is backed)고 합니다. Bref를 만든 Matthieu Napoli란 사람이 더욱 본격적으로 발전시키기 위해 회사를 만들고 이것 저것 한다는 소식.

PHP Versions Stats - 2019.1 Edition

https://blog.packagist.com/php-versions-stats-2019-1-edition/

작년 12월에도 annotated monthly를 통해 공유했던 사이트입니다. 2019년 새로운 통계가 발표되어 소개됐습니다.

Jet Brains의 결과와는 조금 다른데 비교해 보셔도 재미있습니다.

PhpStorm 2019.2 EAP

https://blog.jetbrains.com/phpstorm/2019/05/phpstorm-2019-2-early-access-program-is-open/

PhpStorm 2019.2 EAP가 발표됐다는 소식입니다.

PHP Internals

[RFC] Allow throwing exceptions from __toString()

https://wiki.php.net/rfc/tostring_exceptions

__toString() 안에서 exception을 throw할 수 있는 RFC가 만장일치로 통과됐습니다. PHP Sadness에서 하나 줄었네요!

[RFC] Nullsafe Calls

https://wiki.php.net/rfc/nullsafe_calls

$o?->mayFail1()?->mayFail2()?->mayFail3()?->mayFail4();

“nullsafe”한 새로운 연산자에 대한 제안이 올라왔습니다. 2014년에 처음 올라왔던 것이라고 합니다.

ECMAScript 쪽에서도 이미 제안이 올라와있고, Hack은 이미 구현 했다는군요.

[RFC] Alternative “use” syntax for Closures

https://wiki.php.net/rfc/alternative-closure-use-syntax

Closure 내부에서 use를 사용할 수 있게 하는 제안이 올라왔습니다.

// This is how it looks now
$closure = function (
ArgumentType $argument1,
ArgumentType $argument2,
ArgumentType $argument3,
ArgumentType $argument4
) use ($importVariable1, &$importVariable2, $importVariable3, &$importVariable4): ReturnType {
// ...
};

// This is proposed
$closure = function (
ArgumentType $argument1,
ArgumentType $argument2,
ArgumentType $argument3,
ArgumentType $argument4
): ReturnType {
use $importVariable1, &$importVariable2;
use $importVariable3, &$importVariable4;

// ...
};

PHP Internals News #13, #14

https://phpinternals.news/13
https://phpinternals.news/14

PHP Internal을 다루는 방송인 PHP Internals News의 새로운 에피소드도 소개됐습니다.

13화에서는 PHP 7.2와 7.4의 RM(Release Manager)인 Sara Goleman과 Derick Rethans, 14화에서는 Nikita Popov가 __toString() Exception에 관해 이야기 합니다.

기타 읽을 만한 글

PHP Generics Today (almost)

https://www.daveliddament.co.uk/articles/php-generics-today-almost/

PHP에서 Generic(RFC)을 지원하는 것이 어렵기 때문에 언어 레벨에서 지원하려면 몇년이 걸릴 지도 모른다면서, 기존 툴을 사용해서 Generic을 쓸 수 있는 방법을 설명합니다.

글쓴이는 이미 커뮤니티에서는 비공식적이지만 Generic을 위한 docblock의 사용이 널리 퍼져 있음을 이야기 합니다.
Phan, Psalm, PhpStorm 등의 정적 분석 툴을 비교하고 소개하고 있습니다. 나아가 third party 라이브러리를 위해서는 Stub을 생성하는 방법도 보여줍니다.

Tests and types

https://stitcher.io/blog/tests-and-types

위 Generic에 관한 글과 함께 보면 좋겠습니다. 강한 타입을 기반으로 테스트를 하는 것을 장점을 이야기 하고, 이렇게 타입을 늘려나가는 것에 관한 저자의 소신과 재미있는 세미나 영상을 소개하기도 합니다.

GitHub Actions for PHP Developers

https://stefanzweifel.io/posts/github-actions-for-php-developers/

GitHub Actions에 PHP와 관련한 세가지 Action을 붙이는 과정을 보여줍니다.

  • Run your phpunit test suite
  • Run phpinsights
  • Run php-cs-fixer

A Look At PHP’s isset()

https://medium.com/@liamhammett/a-look-at-phps-isset-df64df7158ab

isset은 함수가 아닙니다. ..로 시작해서 isset의 다양한 특징을 보여줍니다.

Don’t just float, swim with the floating point

https://jiripudil.cz/blog/dont-just-float-swim-with-the-floating-point

PHP에서 부동소수점을 다루는 방법

Global States

https://thevaluable.dev/global-variable-states/

전역의 변경 가능한 상태 값을 최대한 없애자는 이야기

How to Mock Final Classes in PHPUnit

https://www.tomasvotruba.cz/blog/2019/03/28/how-to-mock-final-classes-in-phpunit/

PHPUnit에서 Final로 선언된 클래스를 mocking 하기 (dg/bypass-finals를 사용함)

Reflecting architecture and domain in code

https://herbertograca.com/2019/06/05/reflecting-architecture-and-domain-in-code/

소프트웨어 아키텍처 이야기

https://www.tomasvotruba.cz/php-framework-trends/

Symfony가 압도적입니다. 심지어 Laravel 다운로드 수는 포함하지 않았다고 합니다.

Structuring the Docker setup for PHP Projects

https://www.pascallandau.com/blog/structuring-the-docker-setup-for-php-projects/

PHP 개발 환경으로 Docker를 구성할 때 도움이 될 것으로 보입니다. 아래와 같은 내용을 담고 있네요.

  • 폴더 구조
  • Dockerfile templates
  • 공통적으로 나타나는 문제 해결 (file permissions, runtime configuration, …)

Tools, Symfony, Laravel

나머지 부분은 특별히 번역은 안 하고 넘어 가겠습니다. 관심 있어 찾아보신 분은 댓글로 공유 부탁합니다.

Tools

  • badoo/liveprof
    • A PHP performance monitoring tool. See the introductory post and live demo.
  • remotelyliving/php-dns
    • A DNS abstraction for PHP that allows querying DNS records with different strategies.
  • BrainMaestro/composer-git-hooks
    • Easily manage git hooks in your composer config.
  • hirak/prestissimo
    • A composer plugin to download packages in parallel and increase the speed of the install.
  • ronanguilloux/IsoCodes
    • Validators for the standards from ISO, such as international finance, public administration, book industry, phone numbers, and zip codes for many countries.
  • terrylinooo/shieldon
    • Anti-scraping and online session control for your web application.
  • goldspecdigital/oooas
    • This allows you to build OpenAPI spec using PHP classes, and then export the spec to JSON.

Symfony

Laravel

Security