RepositoryPHP
ZE

zenstruck/foundry

A model factory library for creating expressive, auto-completable, on-demand dev/test fixtures with Symfony and Doctrine.

801sao
114fork
19issue
1lượt xem

Thành tựu nổi bật

Những danh hiệu mới nhất của dự án

1
TINIX TRENDING·Chủ đề: fixtures

#1 Repository Của Tuần

1
TINIX TRENDING·Chủ đề: factory

#1 Repository Của Tuần

2
TINIX TRENDING·Chủ đề: doctrine

#2 Repository Của Tuần

🏗️ Foundry: Tạo fixture test không còn phải "đau đầu"

"Fixtures you'll actually enjoy writing!" — Foundry biến việc tạo dữ liệu test thành trải nghiệm vui vẻ với Symfony và Doctrine.

Foundry là một thư viện model factory giúp bạn tạo ra các fixture phát triển và kiểm thử một cách expressive, auto-completable và on-demand. Dễ dùng như Laravel factories, nhưng dành riêng cho PHP với Symfony và Doctrine.

✨ Điểm nổi bật

  • Factory pattern: Tạo factory cho bất kỳ entity nào một cách nhanh chóng với EntityFactory::new().
  • Trạng thái tùy chỉnh: Định nghĩa các trạng thái như published(), draft() để tạo dữ liệu có nghĩa.
  • Tự động hoàn thiện: IDE hỗ trợ auto-complete toàn diện nhờ cấu trúc factory rõ ràng.
  • Dữ liệu ngẫu nhiên thông minh: Tự động sinh dữ liệu ngẫu nhiên cho các trường chưa chỉ định.
  • Hỗ trợ đa nền tảng: Tương thích với doctrine/orm, doctrine/mongodb-odm hoặc kết hợp cả hai.
  • Tích hợp sẵn với DoctrineFixturesBundle: Dùng trong loader fixture hoặc trực tiếp trong test.
  • Tốc độ test nhanh: Hỗ trợ dama/doctrine-test-bundle để tối ưu tốc độ chạy test.

💡 Vì sao đáng chú ý

Foundry được lấy cảm hứng từ Laravel factories nhưng được thiết kế lại cho PHP hiện đại. Thay vì viết tay từng dòng dữ liệu test, bạn chỉ cần định nghĩa factory một lần và tái sử dụng mọi nơi. Điều này giúp giảm đáng kể thời gian viết test và duy duy trì tính nhất quán trong dữ liệu.

Phù hợp với bất kỳ dự án Symfony/Doctrine nào muốn cải thiện quy trình test và quản lý fixture một cách chuyên nghiệp.


#PHP #Symfony #Doctrine #TestFixtures #FactoryPattern #TiniX

Dự án tương tự

Khám phá các dự án và mô hình AI khác có sự tương đồng.

RepositoryPHP
kimai/kimai

Kimai is the #1 open-source time-tracking application. From freelancers to companies and organisations - everyone can manage timesheets, generate reports, create invoices and so much more... Web-based multi-user application, available as On-Premise or SaaS version: https://www.kimai.org

5.1k
Oct 20, 2026
RepositoryPHP
doctrine/DoctrineBundle

Symfony Bundle for Doctrine ORM and DBAL

4.8k
Oct 21, 2026
RepositoryPHP
doctrine/DoctrineMigrationsBundle

Symfony integration for the doctrine/migrations library

4.3k
Aug 31, 2026
RepositoryPHP
nelmio/alice

Expressive fixtures generator

2.5k
Jun 15, 2026
RepositoryPHP
doctrine/DoctrineFixturesBundle

Symfony integration for the doctrine/data-fixtures library

2.5k
Oct 15, 2026
RepositoryElixir
elixirs/faker

Faker is a pure Elixir library for generating fake data.

1.2k
Oct 26, 2026
RepositoryJava
keepcosmos/beanmother

A library for setting up Java objects as test data.

122
Dec 14, 2022
RepositoryGo
pioz/faker

Random fake data and struct generator for Go.

102
Oct 6, 2023
RepositoryPHP
symfony/symfony

The Symfony PHP framework

31.2k
Oct 20, 2026