samdark blog ☕️ (Alexander Makarov)
1.63K subscribers
138 photos
2 videos
214 links
Notes taken by Alexander Makarov, lead of Yii framework, CTO of Twindo.ai and a long term IT engineering manager.

- Official Yii updates: www.yiiframework.com
- Consulting: asapirl.com
Download Telegram
🎨 PHP website redesign competition

PHP Foundation launched PHP website redesign competition. Would be interesting to watch and participate.

https://thephp.foundation/blog/2025/10/01/design-contest/


#php #design
🔥11👍8😁5
👍 Fixing `git blame` after reformatting all code

Living without automated and enforced code style is a mess. But starting with it is painful as well cause it ruins git blame. It is starting to point to the developer who reformatting the code instaed of the one who wrote it. There’s a way to fix it.

1. Create .git-blame-ignore-revs and fill it with a list of commit IDs to ignore. The ones reformatting code.
2. Now either use git blame --ignore-revs-file .git-blame-ignore-revs or configure git to do it automatically with git config blame.ignoreRevsFile .git-blame-ignore-revs.

btw., we have such file in Yii2: https://github.com/yiisoft/yii2/blob/master/.git-blame-ignore-revs for exactly that case. GitHub supports this exact file name in the root of the repository automatically.

#git #github
👍14🔥124👀2
Forwarded from Yii3 Chronicles
#yiisoftAppApi #FirstRelease #MajorRelease #Release

🎁 API Application Template 1.0

The first stable release of the API application template for Yii3.

The template includes the essential things required to start API application development:

• middleware dispatcher,
• routing,
• a set of response formats for APIs (success, error, collection, pagination, …),
• exception handling,
• console entry point,
• tests and static analysis,
• Docker,
• and more...

As an example, a simple API method and a console command are implemented. The template does not impose any restrictions on the architecture of the developed application and is open for integration with any PHP libraries.
🔥32👍157
📝 Оценка зрелости инженерных процессов

Мы с Алексеем Обыскаловым, автором канала «CTO: порядок из хаоса», проводим исследование, чтобы понять, что реально происходит внутри ИТ-команд и какие закономерности можно в этом увидеть.

Уже нащупали интересные корреляции:
– между скоростью пайплайнов и качеством code review,
– между алертингом и стабильностью релизов,
– между ролями в команде и удовлетворённостью релизным процессом.

Но нужно больше данных, чтобы отделить закономерности от шума.

Пройти анкету можно за 10 минут. Её же можно использовать как мини-чек-лист для самооценки зрелости инженерной культуры.

Принять участие: https://forms.gle/NszR7VDuXL9sBbVAA
🔥108👍5
🎨 On editor code highlighting

Nikita Prokopov wrote a post on syntax highlighting. I like how he questions everything that we've got used to. I don't agree with everything but some points are definitely valid:

1. Comments are often more important than code.
2. Top level definitions and interface signatures are more important than implementation.
3. Our brain capacity is limited so too many colors aren't really useful. Common things could stay without color.

#brain #colors #code #ide
👍4🤔32🔥1
📊 The State of PHP 2025

Interesting report from JetBrains.

1. More than a half of existing PHP users aren't looking into other languages to switch to.
2. 72% are using PHP for more than 4 years.
3. 89% are using PHP8.
4. VSCode adoption for PHP development is getting lower.
5. XDebug is used more but var_dump is still the king.

https://blog.jetbrains.com/phpstorm/2025/10/state-of-php-2025/

#php
🔥17👍10😁42🥴1
🌨 Do not assume reliability

AWS is down today and affected many many services worldwide including very important ones such as Docker Hub.

That's a good reminder that redundancy is not an optional thing if you care about your service or it's data.

Time to check your infra.

#aws #infra
👍18😱5🤯2🔥1👏1💯1
📊 DI container doesn't really need lazy objects

Lazy objects in PHP are a very interesting feature that allows you to defer heavy initialization in many cases. I wanted to use these immediately somewhere where it would give maximum performance gains. The obvious choice was a DI container. It instantiates many objects every request or worker initialization; thus, the impact should be significant.

But, thinking more about it, it's not the case. Dependencies are nowadays obtained by type-hinting mostly:

final class MyClass
{
public function __construct(
private MyDependency $dependency,
private CacheInterface $cache
)
{}
}


The key here is that what we obtain what we use almost immediately, usually in the same class, and all modern DI containers are lazy nowadays; no object is being created if it's not going to be used. Thus, the laziness of the service object itself doesn't give us anything unless the code of the application is very messy.

#php #di #performance
👍14🔥41👎1👀1
🚀 Ищем волонтеров на крупнейшие IT-конференции в Москве!

HighLoad++
— это конференция в России и СНГ, посвящённая разработке высоконагруженных систем, архитектуре, инфраструктуре и масштабированию.
TeamLead Conf — единственная профессиональная конференция для тимлидов и руководителей не только из IT.

Если тебе интересно увидеть закулисье одного из самых масштабных IT-событий страны, получить опыт организации конференции и стать частью сильной команды — присоединяйся к волонтёрам 💪

🗓 Даты участия: 4–11 ноября (можно выбрать 4 дня или один из дней)
📍 Место проведения: Технопарк «Сколково»

Что тебя ждёт:
– уникальный опыт работы на ведущих конференциях в России
– общение с экспертами и профессионалами из крупнейших IT-компаний
– понятные задачи и поддержка координаторов
– доступ к записям выступлений и атмосфера закулисья
– полноценное питание в дни работы
– и, конечно, участие в легендарном afterparty HighLoad++ 🎉

Задачи волонтёров: работа в залах, помощь в логистике на площадке, регистрация участников, помощь в зоне выставки.

Участие предполагает присутствие в день до конференции, чтобы познакомиться с командой, подготовиться к работе и пройти инструктаж, и два дня самого события.

📩 Чтобы присоединиться, заполни анкету волонтёра — мы свяжемся с тобой после рассмотрения заявки.

Расскажи о наборе друзьям, приходите вместе — давайте создавать легендарную атмосферу🔥
👍122👎2🔥2
GitHub OpenSource stats 2025

GitHub released a report about developers landscape.

PHP is number 6 in the top surpassing C, C++, Go by the number of developers using it.

Docker usage got +120%.

LLMs got to general adoption stage. 80% of developers using them now.

#statistics #php #github
👍214🔥3👀2
Инженерная зрелость. Исследование практик и триггеров

Итак, исследование завершилось. Вот что вышло.

https://habr.com/ru/articles/963202/
👍19🤣9😁32🔥2
HighLoad++ 2025

The program team of the conference. Glad to be among them selecting the talks for many years.

For me conferences are part of the industry and community. The place where you can get connections and ideas regardless of your role, stack and language. Every time after the conference I note some of the ideas to try and something to apply to Yii and other projects.

Do you think conferences are necessary? What do you get from them? What do you enjoy? What do you think is bad?

#events
👍16🔥5👏54
🎁 PHP 8.5

New PHP version released. I personally like:

- "Clone With"
- Callables in constant expressions
- array_first() and array_last()
- Backtrace for fatal errors
- php --ini=diff

// expect Yii2 release soon

#php
👍33🔥16🍾96
Новый сезон онлайн-конференции Podlodka PHP Crew (1–5 декабря) посвящён тому, как делать больше за то же время — без стресса и овертаймов.

📌 В программе:

⚙️ Background-агенты в разработке — Пётр Мязин («Пятиминутка PHP») покажет, как построить процесс вокруг ИИ-инструментов.

🚦Светофоры для разработчиков — Ярослав Тарасов (Skyeng) расскажет, как ускорить обратную связь от коммита до продакшена.

🔥Баланс фич и техдолга — Дмитрий Кириллов поделится холиварным кейсом «100% фичи, 0% техдолг».

🧩 От промпта к продакшену — Павел Бучнев (Spiral Scout) объяснит, почему пора мыслить контекстами, а не только промптами.

⚡️Практика, кейсы и новые подходы, которые экономят часы и силы.

🔗 Подключайтесь с 1 декабря: https://podlodka.io/phpcrew

Скидка 500 р по промокоду: samdark_blog_7
👍65🔥4
Channel name was changed to «samdark blog ☕️ (Alexander Makarov)»
Forwarded from Yii3 Chronicles
#yiisoftDb #yiisoftDbMssql #yiisoftDbMysql #yiisoftDbPgsql #yiisoftDbSqlite #yiisoftDbOracle #MajorRelease #Release

🎁
Yii Database 2.0
🎁
Yii DB MSSQL Server 2.0
🎁
Yii DB MySQL 2.0
🎁
Yii DB PostgreSQL 2.0
🎁
Yii DB SQLite 2.0
🎁
Yii DB Oracle 2.0

We're excited to announce Yii Database 2.0, a major release modernizing the database abstraction layer with PHP 8.1+ features, enhanced type safety, and powerful new capabilities. The drivers have been released as well.

New Features

- Implement ColumnInterface classes according to the data type of database table columns
for type casting performance
- ConnectionProvider for connection management
- ColumnBuilder for column creation
- CaseX expression for CASE-WHEN-THEN-ELSE statements
- New conditions: All, None, ArrayOverlaps, JsonOverlaps
- PHP backed enums support
- User-defined type casting
- ServerInfoInterface and its implementation

Enhancements

- Optimized SQL generation and query building
- Improved type safety with psalm annotations
- Method chaining for column classes
- Better exception messages
- Refactored core components for better maintainability
- PHP 8.5 support

There have also been many refactorings and bug fixes. See CHANGELOG.md for more information.

See upgrading instructions with notes about upgrading package in your application to this major version.
👍23🔥22🎉8👏42
🎉 Accepting birthday gifts

Tomorrow is my birthday. I'd gladly accept pull request to Yii repositories as a gift. Thanks!
🎉88😁35👍7🔥1
🤔 DDD Aggregates: The ID Problem

When I was learning DDD concepts, I had trouble implementing aggregates: a set of objects that are saved together in a single transaction. The theory made sense, but the practice felt wrong.

The problem was auto-increment IDs from the database. When the database creates IDs, you must save your object first to get an ID. This means your aggregate isn't complete until after you save it. This breaks the DDD concept—aggregates should be complete, valid objects before touching the database.

Transactions became messy. Do I save the parent first, then the children? How do I connect child objects before they have IDs?

The solution is to generate UUIDs in PHP instead. Once I've started using these instead of auto-increment, I was able to create aggregates in memory with all relationships before saving anything. In this case child objects have IDs immediately. Transactions are simple—save everything at once. The database is just storage, not something that controls my code structure.

This one change made DDD aggregates finally work for me. If you have similar problems, try generating IDs in your code instead of using database auto-increment.

#ddd #uuid #autoincrement #aggregate
👍42🔥8
Forwarded from Yii3 Chronicles
#yiisoftActiveRecord #FirstRelease #MajorRelease #Release

🎁
Yii Active Record 1.0

We are pleased to present the first stable release of Yii Active Record — an implementation of the Active Record pattern for PHP.

The package is built on top of Yii DB, which means it comes with out-of-the-box support for major relational databases: PostgreSQL, MySQL, MSSQL, Oracle, SQLite.

⭐️ Flexible Model Property Handling

• Dynamic properties — fast prototyping with #[\AllowDynamicProperties]
• Public properties
• Protected properties — encapsulation via getters/setters
• Private properties
• Magic properties

⭐️ Powerful Relation System

• One-to-one
• One-to-many
• Many-to-one
• Many-to-many — three implementation approaches (junction table, junction model, key array)
• Deep relations — access to related records through intermediate relations
• Inverse relations
• Eager loading — solves the N+1 problem

⭐️ Extensibility via Traits

ArrayableTrait — convert a model to an array
ArrayAccessTrait — array-style access to properties
ArrayIteratorTrait — iterate over model properties
CustomConnectionTrait — custom database connection
EventsTrait — event/handler system
FactoryTraitYii Factory integration for DI
MagicPropertiesTrait and MagicRelationsTrait — magic accessors
RepositoryTrait — repository pattern

⭐️ Additional Features

• Optimistic Locking — concurrency control using record versioning
• Dependency Injection — support for constructor-based injection
• Flexible configuration — multiple ways to define the database connection

🖼 Example

Example AR class:

/**
* Entity User
*
* Database fields:
* @property int $id
* @property string $username
* @property string $email
**/
#[\AllowDynamicProperties]
final class User extends \Yiisoft\ActiveRecord\ActiveRecord
{
public function tableName(): string
{
return '{{%user}}';
}
}


And its usage:

// Creating a new record
$user = new User();
$user->set('username', 'alexander-pushkin');
$user->set('email', 'pushkin@example.com');
$user->save();

// Retrieving a record
$user = User::query()->findByPk(1);

// Read properties
$username = $user->get('username');
$email = $user->get('email');
Please open Telegram to view this post
VIEW IN TELEGRAM
🔥38👍1710🎉3
Forwarded from Yii3 Chronicles
#yiisoftData #MajorRelease #Release

🎁 Yii Data 2.0

Yii Data 2 is now available, bringing major improvements and modernization to this package that provides generic data abstractions for reading, writing, and processing.

• PHP 8.1+ required: modernized codebase with readonly properties and improved type safety.

• Enhanced filtering: added Stringable support, nested value filtering, case-sensitive Like filter with matching modes, and new All/None filters.

• Improved pagination: new LimitableDataInterface, nextPage()/previousPage() methods, PageToken class, and better limit handling in paginators.

• Better developer experience: comprehensive Psalm annotations, PageNotFoundException for clearer error handling, and OrderHelper for low-level order operations.

For a complete list of changes, see the CHANGELOG.md.
👍14🔥84