PHP Annotated – May 2022

Php_annotated 이미지

Roman Pronskiy가 쓰고 JetBrains에서 제공하는 PHP Annotated 2022년 5월의 번역/해석본입니다.

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


안녕하세요!

PHP Annotated 5월호에 오신 것을 환영합니다. 여기에서는 선별된 뉴스, 기사, 도구 및 비디오를 포함하여 지난 한 달 동안 PHP 세계에서 일어난 가장 흥미로운 일을 따라잡았습니다.

PHP Annotated 5월호를 편집하는 데 도움을 준 Sergey Panteleev에게 감사드립니다.

News

PHP 8.1.6 and PHP 8.0.19 released

https://www.php.net/ChangeLog-8.php#8.1.6
https://www.php.net/ChangeLog-8.php#8.0.19

활성(active) branch에 비보안 버그 수정 업데이트입니다.

Release managers for PHP 8.2 have been selected!

https://wiki.php.net/todo/php82

PHP 8.2의 릴리스 관리자가 선정되었습니다!

바로 Pierrick CharronSergey Panteleev입니다. PHP 8.1 RM인 Ben Remsey가 새로운 신입 RM을 도울 것입니다.

PHP.Watch 및 Brent의 What’s new in PHP 8.2 게시물에서 PHP 8.2가 어떻게 형성되고 있는지 확인할 수 있습니다. 첫 번째 예비 PHP 8.2 벤치마크는 PHP 8.1에 비해 2.5% 성능 향상을 보여줍니다.

https://www.bleepingcomputer.com/news/security/popular-python-and-php-libraries-hijacked-to-steal-aws-keys/

PHPass 패키지가 어떻게 해킹되었는지 알아보세요. (위 기사와는 조금 다른 내용입니다.)

  • Rust/Python/PHP/Node의 유명 패키지 레지스트리에서 소유자의 이메일이나 연결된 github 계정이 유효하지 않는 패키지를 탈취할 수 있음을 보여주고,
    이메일 계정을 탈취하기 위해 도메인을 구입하거나 폐기된 GitHub 리포지토리를 다시 살렸다고 합니다(사실 폐기된 리포지토리명으로 생성은 안 되는데 아무렇게 만든 뒤 변경하는 방식으로는 가능했습니다). 이렇게 탈취한 뒤 악성코드를 심어 새로운 버전을 올리거나 최신 버전을 수정(이것도 문제)한 뒤 사용자들이 가져가게 합니다.

https://www.php-fig.org/psr/psr-7/meta/#7-errata

PHP-FIG는 PSR-7에 대한 보안 관련 정오표를 게시했습니다. MessageInterface 구현 시 몇몇 문자를 거부하는 등 헤더를 검증해야 합니다.

WordPress 6.0

https://wordpress.org/news/2022/05/arturo/

많은 유용한 기능과 UI 개선이 포함됐습니다.

Moodle 4

https://moodle.com/news/moodle-4-is-here/

인기 있는 오픈 소스 e-러닝 플랫폼의 주요 업데이트입니다.

Developer Ecosystem Survey 2022

https://surveys.jetbrains.com/s3/t-developer-ecosystem-survey-2022

2022년 개발자 에코시스템에 관한 설문조사에 참여하여 MacBook Pro, Xbox Series X, PlayStation 5 또는 기타 상품을 받을 수 있는 기회를 잡으십시오.

PHP Core

Core 뉴스의 대부분은 PHP Foundation의 PHP Core Roundup 시리즈에서 자세히 다룹니다. 시리즈의 두 번째 에피소드가 곧 출시될 예정이므로 간략하게만 언급하겠습니다.

🤔 [RFC] Stricter implicit boolean coercions

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

논의 중.

암시적인 bool 값 변환을 좀 더 엄격하게 제한하고자 합니다.

🤔 [RFC] Expand deprecation notice scope for partially supported callables

https://wiki.php.net/rfc/partially-supported-callables-expand-deprecation-notices

논의 중.

이미 8.2에 accept된 [PHP RFC: Deprecate partially supported callables]의 범위를 확장하고자 하는 추가 RFC입니다. 이 RFC에 대한 자세한 내용은 Julliette와 함께하는 PHP Internals News 팟캐스트를 들어보십시오.

✅ [RFC] Undefined Property Error Promotion

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

PHP 9.0에 Accept 됐습니다.

정의되지 않은 속성에 엑세스하면 이전엔 E_NOTICE, PHP 8.0부터는 E_WARNING, PHP 9.0부터는 error를 throw합니다.

✅ [RFC] MySQLi Execute Query

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

PHP 8.2에 Accept 됐습니다.

매개변수화된 쿼리와 함께 mysqli를 더 쉽게 사용할 수 있습니다.

✅ [RFC] Readonly classes

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

PHP 8.2에 Accept 됐습니다.

Giuseppe Mazzapica(@gmazzap)의 트윗

With https://wiki.php.net/rfc/readonly_classes accepted, having read-only & type-safe simple data structures is going to be very easy in PHP 8.2
readonly class sample code

The PHP Foundation: Interview with Core Developers

https://thephp.foundation/blog/2022/05/06/interview-with-core-developers/

PHP 재단의 핵심 개발자와의 인터뷰 – Sebastian Bergman이 George, Derick, Ilija, Jakub 및 Máté를 인터뷰합니다. 곧 Arnaud의 답변도 알려 드리겠습니다.

opcache 최적화 프로그램

https://www.npopov.com/2022/05/22/The-opcache-optimizer.html

Nikita Popov는 PHP 핵심 엔진에 대한 심층 분석 시리즈를 계속합니다.

Tools

azjezz/psl 2.0

https://github.com/azjezz/psl

PHP 표준 라이브러리 – 현대적이고 일관되고 중앙 집중식이며 type을 충분히 사용하는 PHP용 non-blocking API 세트입니다. 이 주요 업데이트에는 비동기, TCP, UDP, 파일, IO 등과 같은 많은 개선 사항과 새로운 구성 요소가 포함되어 있습니다.

clue/framework-x

https://github.com/clue/framework-x

반응형 웹 애플리케이션을 구축하기 위한 간단하고 빠른 마이크로 프레임워크입니다. ReactPHP 비동기 스택 위에서 실행됩니다.

Christian Lück(@another_clue)의 트윗

@ReactPHP is going to be even more awesome! 🚀
Currently boosting performance from 32000 to 39000 requests/s.
This makes 18 billion requests per month on top 😎 On my laptop! On a single CPU core! 🔥
PHP scales! 💯

MedUnes/php-spx-installer

https://github.com/MedUnes/php-spx-installer

PHP SPX(A simple profiler for PHP)용 설치 프로그램입니다.

bmitch/churn-php

https://github.com/bmitch/churn-php

리팩토링이 필요한 파일을 검색합니다. 경로에 있는 각 PHP 파일을 검사하고 순환적 복잡성과 변경 기록을 기반으로 점수를 부여합니다.

PhpStorm에서는 여러 메트릭을 기반으로 리팩토링 후보를 찾는 built-in Refactoring Opportunities 검사를 활성화할 수 있습니다. 여기에서 자세히 알아보십시오.

Refactoring Opportunities 검사 옵션

역자 주 :
PhpStorm 2021.2부터 들어왔지만, IntelliJ에 PHP plugin을 사용하고 계신 분이면 이 옵션이 안 보일 수 있습니다. 이때는 PHP Architecture plugin을 추가로 설치하시면 됩니다.
아래 플러그인으로도 비슷한 효과를 보실 수 있습니다.

Monolog 3.0

https://github.com/Seldaek/monolog/releases/tag/3.0.0

대부분 cleanup 릴리스입니다. 더 강력한 type을 제공하고 이제 최소 PHP 8.1이 필요합니다.

Tinkerwell 3

https://tinkerwell.app/

The paid PHP code runner received a major update. Learn more.
유료 PHP 코드 러너가 메이저 업데이트 됐습니다. 자세히 알아보기.

Blackfire.io

https://blackfire.io/

PHP 코드에서 병목 현상을 찾기 위한 이 다목적 도구는 이제 오픈 소스 프로젝트에서 무료입니다 .

TomasVotruba/awesome-php-ast

https://github.com/TomasVotruba/awesome-php-ast

A curated list of tools, articles, and books about abstract syntax trees in the PHP world.
PHP 세계의 추상 구문 트리에 대한 도구, 기사 및 책의 선별된 목록입니다.

friendsoftwig/twigcs

https://github.com/friendsoftwig/twigcs

Twig 템플릿의 스타일 체커.

PHPStan 1.7.0

https://phpstan.org/

완전히 static한 리플렉션을 추가하고 @phpstan-consistent-constructor를 구현하고 new static() 문제를 해결하는 또 다른 방법으로 새로운 규칙을 추가한 버전입니다.

역자 주:
현재 블로그에는 1.7에 관한 내용이 없는데, GitHub release 페이지에서 내용을 확인하실 수 있습니다.

Latte 3.0.0

https://blog.nette.org/en/latte-3-an-impressive-leap#

완전히 재작성된 인기있는 템플릿 엔진의 업데이트.

dingo-d/wp-pest-integration-test-setup

https://github.com/dingo-d/wp-pest-integration-test-setup

Pest로된 WordPress 통합 테스트 스위트를 추가하는 패키지입니다. 사용 방법에 대한 자세한 내용은 이 블로그 게시물을 읽어 보세요.

CuyZ/Valinor

https://github.com/CuyZ/Valinor

모든 입력을 강력한 형식의 값 개체 구조로 매핑하는 데 도움이 되는 PHP 라이브러리입니다.

Symfony

what’s coming in Symfony 6.1

https://symfony.com/blog/category/living-on-the-edge/6.1

Symfony 6.1에서 제공 되는 기능을 확인하세요.
attribute를 통한 서비스 자동 연결(autowiring)개선된 라우팅 기능이 커뮤니티에서 가장 인기가 많은 것 같습니다. 지금까지 여러분께 가장 좋았던 것은 무엇인가요?

Experimental: Unpacking message properties as handler arguments in Symfony Messenger

https://angelovdejan.me/2022/05/10/experimental-unpacking-message-properties-as-method-arguments.html

Dejan Angelov의 Symfony Messenger에서 메시지 속성(property)을 핸들러 인수(argument)로 자동으로 전달하는 실험.

역자 주:
PHP attributes를 활용한 포스트 Using custom PHP attributes for registering and configuring Symfony Messenger handlers에서 이어지는 글입니다.

Why do we need Symfony Polyfill (… and why we shouldn’t)

https://thecodest.co/blog/why-do-we-need-symfony-polyfill-and-why-we-shouldnt

Sebastian Luczak의 Symfony Polyfill이 필요한 이유(… 그리고 필요하지 않은 이유).

nbgrp/singlea

https://github.com/nbgrp/singlea

SingleAuth 인증 프레임워크를 기반으로 하는 진정한 SSO 서비스를 제공하는 Symfony 번들 세트입니다.

Laravel

Does Laravel Scale? by Jack Ellis.

https://usefathom.com/blog/does-laravel-scale

“라라벨은 확장할 수 있습니까?” by Jack Ellis.

글쓴이가 운영하는 Fathom Analytics팀은 월 1,570억 개 이상의 요청을 처리할 수 있는 인프라에서 Laravel을 실행합니다.

역자 주:
Laravel이 대규모로 애플리케이션을 처리할 수 없을 거라는 부정적인 시각에 반박합니다.

  • 대부분이 Wikipedia나 Facebook 만큼의 트래픽을 처리할 생각은 아닐 것
  • 라라벨의 벤치마크 점수는 낮지만, 벤치마크는 큰 의미가 없다.
  • 주요 병목 현상의 원인이 되는 데이터베이스, 캐시 등의 외부 서비스 연동에서 발생하는 문제를 해결해야 하고, CDN, Queue system이나 Laravel Octane 같은 도구를 사용할 수도 있다. 커뮤니티 지원도 중요하다.
  • 대규모 서비스를 위한 코드 작성이나 대규모로 배포를 위한 방법도 고민해야 한다.
  • 결론 : Laravel이 99.99994% 이상의 웹 애플리케이션을 위한 환상적인 선택이라는 것

The Ultimate Guide to Getting Started With Laravel

https://blog.freshbits.in/the-ultimate-guide-to-getting-started-with-laravel

Gaurav Makhecha의 Laravel 시작을 위한 궁극의 가이드.
초보자가 처음부터 Laravel을 배울 수 있도록 도와주는 포괄적이고 긴 튜토리얼입니다.

Eloquent Performance: 4 Examples of N+1 Query Problems

https://laravel-news.com/laravel-n1-query-problems

Laravel Daily의 Povilas Korop이 이야기하는 N+1 Query의 4가지 사례

  • Case 1. 일반적인 N+1 Query
  • Case 2. Two Important Symbols.
  • Case 3. “Hidden” Relationship in Accessor.
  • Case 4. Be Careful with Packages.

Laravel 8.43부터 built-in N+1 Query detector가 도입됐습니다!

How to add a spotlight-like search field to your Laravel app by Freek Van der Herten.

https://freek.dev/2251-how-to-add-a-spotlight-like-search-field-to-your-laravel-app

Freek Van der Herten의 Laravel 앱에 스포트라이트 같은 검색 필드를 추가하는 방법.
중첩된 메뉴가 끔찍하기 때문이죠.

Laravel DDD by Steve McDougall.

https://www.juststeveking.uk/getting-started-with-ddd-in-laravel/

Laravel에서 DDD 시작하기.

roelofjan-elsinga/aloia-cms

https://github.com/roelofjan-elsinga/aloia-cms

라라벨에서 drop-in CMS를 구현하기 위한 패키지. 컨텐츠를 저장하기 위해 파일을 사용합니다.

The Laravel Idea plugin for PhpStorm collaborated with Christoph Rumpel to bring

https://laravel-idea.com/

PhpStorm용 Laravel Idea 플러그인. Christoph Rumpel과 협력 하여 📺 비디오 자습서 시리즈를 제공 합니다.

기타

Attribute usage in the top-1000 PHP packages

https://stitcher.io/blog/attribute-usage-in-top-php-packages

Brent Roose의 상위 1000개 PHP 패키지에서 Attribute 사용 여부 조사.
스포일러: 그들 중 20%만이 Attribute를 사용하며 가장 많이 사용되는 Attribute는 #[ReturnTypeWillChange]입니다.

📺 Dealing with deprecations by Brent Roose.

https://stitcher.io/blog/dealing-with-deprecations

Brent는 PHP 8.2에 많이 추가된 deprecation에 효과적으로 대처하는 방법에 대해 설명합니다.

그건 그렇고, PhpStorm에서 #[Deprecated(reason: '', replacement: '')] attribute로 업그레이드하는 방법을 사용자에게 지시할 수 있습니다 - 자세히 알아보기.

Dockerize a PHP Application with CI/CD by Rafie Younes.

https://semaphoreci.com/community/tutorials/dockerizing-a-php-application

How to profile your PHP applications with Xdebug by Vincent Brouté.

https://www.vincentbroute.fr/blog/how-to-profile-your-php-applications-with-xdebug/

Xdebug로 PHP 애플리케이션을 프로파일링하는 방법 .

Much ado about null by Larry Garfield.

https://peakd.com/hive-168588/@crell/much-ado-about-null

왜 당신이 정말로 그 null type을 사용하고 싶은지, 그리고 당신이 그 대신에 무엇을 해야 하는지.

Move that foreach() inside the method by Damien Seguy.

https://www.exakat.io/en/move-that-foreach-inside-the-method/

여러 PHP 함수는 단일 또는 다중 값으로 작동합니다. 예를 들어 array_merge()는 여러 배열을 하나로 병합합니다.
각 요소를 개별적으로 처리하기 위해 동일한 메서드를 여러 번 호출하는 대신 인수 목록을 한 번에 처리하여 약간의 성능 향상을 얻을 수 있습니다.

역자 주:
지난 php-annotated에 소개된 Speeding up array_merge()도 참고하세요.

Steve Bauman(@SteveTheBauman)의 트윗

https://twitter.com/SteveTheBauman/status/1525525749461135361

Today I learned you can unpack conditionally in PHP, pretty neat! 👌
Steve Bauman(@SteveTheBauman)의 트윗

Hadi Hariri(@hhariri)의 트윗

https://twitter.com/hhariri/status/1524018677116506114

“언젠가 여러 구현을 가질 수 있기 때문에 인터페이스를 선언하고 있습니다.”라고 말하는 사람이 있죠.
물론입니다. 그 날이 오면 Extract Interface 리팩토링을 수행하세요. 대부분의 IDE는 한 번의 클릭으로 이를 수행합니다. 그때까지 인터페이스를 삭제하십시오.

Community

friendsofphp.org

https://friendsofphp.org/

가까운 PHP 모임을 찾아보세요! 그들이 마침내 돌아왔습니다! 또한 가상 이벤트를 제공하는 새로운 PHP Mega Meetup GroupMerge PHP도 있습니다.

📺 The PHP Roundtable podcast - Back at the Table in episode 84

https://www.youtube.com/watch?v=JkIqSy1tylM

With Sara Golemon, Joe Ferguson, Ben Ramsey, and Eric Van Johnson.

awesome new paper elephants by Vincent Pontier

https://www.vincentpontier.com/elephpant/categorie-produit/phpaper-toy/?orderby=price

Vincent Pontier의 멋진 새 종이 코끼리 를 확인하세요.

종이 코끼리 이미지

thelia.net/#Elephant

https://thelia.net/#Elephant

고전적인 플러시 천 디자인을 선호한다면 여기 당신의 무리에 추가할 만한 멋진 품목이 있습니다!

플러시 천 코끼리 인형 이미지