framework:make:collection

Generate a type-safe Collection class for PHP entities using Atournayre traits.

9|2|Updated Oct 19, 2025
One-click install
npx skills add https://github.com/atournayre/claude-marketplace --skill framework-make-collection
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: framework:make:collection
Source: https://github.com/atournayre/claude-marketplace/tree/main/framework/skills/make-collection
Command: npx skills add https://github.com/atournayre/claude-marketplace --skill framework-make-collection

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires atournayre/framework, and includes references (resource) components.

What problem does it solve?

This Skill eliminates the repetitive manual coding required to create type-safe collection classes for your PHP entities, saving developers hours of boilerplate work.

Core Features & Use Cases

  • Type-Safe Collections: Automatically generate strongly-typed collection classes that prevent runtime errors.
  • Elegant Object Principles: Implement best practices with final classes, factories, and immutability.
  • Use Case: Imagine you have a Product entity and need to manage collections of products. This Skill generates a ProductCollection class with built-in counting, filtering, and conversion methods in seconds.

Quick Start

Use skill framework:make:collection to create a typed collection for your Product entity.

Frequently Asked Questions about framework:make:collection

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate a type-safe collection class for my PHP entities?

Type-safe collection classes enforce strict typing to prevent runtime errors when managing entity sets. Use framework:make:collection to automatically generate a final Collection class with built-in interfaces and traits for your specific entity, eliminating manual boilerplate and ensuring consistency across repositories and services.

What interfaces and traits are included in a generated PHP collection?

Generated collections automatically implement AsListInterface, ToArrayInterface, CountInterface, and logging interfaces, plus base Collection traits with toArray and Countable methods. This provides counting, filtering, array conversion, and logging capabilities out of the box.

Can I use framework:make:collection with existing Atournayre projects?

Yes. The Skill requires the Atournayre framework as a dependency and generates collections scoped to your entities. It integrates seamlessly with existing repositories, services, and controllers that use Atournayre traits and patterns.

What methods does a generated collection provide for querying and logging?

Generated collections include an asList factory method for instantiation, toLog logging method for debugging, and counting methods (HasOneElementInterface, HasXElementsInterface, HasNoElementInterface). These enable type-safe querying, element inspection, and structured logging without custom implementation.

Why use generated collections instead of manual collection classes?

Manual collection classes require repetitive code for type safety, factories, and interface compliance. Generating them saves hours of boilerplate, ensures consistency across your codebase, and automatically applies Atournayre best practices like immutability and final class declarations.