PHPackages                             apetitpa/card-factory - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. apetitpa/card-factory

ActiveLibrary

apetitpa/card-factory
=====================

CardFactory is a PHP library designed to simplify the creation and management of card decks for card games. It provides an organized and extensible structure with classes and enumerations for cards, suits, values, and decks, making it easy to build and manipulate card decks in a variety of game scenarios.

v1.1.0(3y ago)17MITPHPPHP &gt;=8.1

Since Mar 26Pushed 3y ago1 watchersCompare

[ Source](https://github.com/apetitpa/card-factory)[ Packagist](https://packagist.org/packages/apetitpa/card-factory)[ RSS](/packages/apetitpa-card-factory/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (4)Versions (3)Used By (0)

CardFactory
===========

[](#cardfactory)

[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://opensource.org/licenses/MIT)[![CI](https://github.com/apetitpa/card-factory/actions/workflows/ci.yaml/badge.svg?branch=main)](https://github.com/apetitpa/card-factory/actions/workflows/ci.yaml/badge.svg?branch=main)

CardFactory is a PHP library designed to simplify the creation and management of card decks for card games. It provides an organized and extensible structure with classes and enumerations for cards, suits, values, and decks, making it easy to build and manipulate card decks in a variety of game scenarios.

Requirements
------------

[](#requirements)

- PHP &gt;= 8.1

Installation
------------

[](#installation)

To install CardFactory, use [Composer](https://getcomposer.org/):

```
composer require apetitpa/card-factory
```

Usage
-----

[](#usage)

Here's a basic example of how to use CardFactory to create and manipulate a deck of cards:

```
use Apetitpa\CardFactory\Model\Deck;

// Create a standard deck of 52 playing cards (shuffled by default)
$deck = Deck::createStandardDeck();

// To create an ordered (not shuffled) deck, use:
$deck = Deck::createStandardDeck(false);

// Shuffle the deck
$deck->shuffle();

// Draw the top card from the deck
$card = $deck->drawCard();

// Check the card's suit and value
$suit = $card->getSuit();
$value = $card->getValue();
```

Running the project locally
---------------------------

[](#running-the-project-locally)

You can install CardFactory via [Composer](https://getcomposer.org/):

```
make install
```

Code analysis
-------------

[](#code-analysis)

CardFactory uses [PHPStan](https://phpstan.org/) and [Psalm](https://psalm.dev/) for static code analysis. To run PHPStan and Psalm, follow these steps:

### PHPStan

[](#phpstan)

```
make phpstan
```

### Psalm

[](#psalm)

```
make psalm
```

Testing
-------

[](#testing)

To run the tests, execute the following command at the root of the project:

```
make test
```

License
-------

[](#license)

CardFactory is open-source software licensed under the [MIT license](https://opensource.org/licenses/MIT).

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

2

Last Release

1142d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6a76c7571a01d56f20746e85225a67495d32f6288b9a093dbf2840500c9f9e30?d=identicon)[apetitpa](/maintainers/apetitpa)

---

Top Contributors

[![apetitpa](https://avatars.githubusercontent.com/u/15359729?v=4)](https://github.com/apetitpa "apetitpa (2 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/apetitpa-card-factory/health.svg)

```
[![Health](https://phpackages.com/badges/apetitpa-card-factory/health.svg)](https://phpackages.com/packages/apetitpa-card-factory)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
