PHPackages                             susanbuck/rock-paper-scissors - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. susanbuck/rock-paper-scissors

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

susanbuck/rock-paper-scissors
=============================

Rock Paper Scissors

0.1.6(4y ago)11033MITPHP

Since Oct 22Pushed 4y ago1 watchersCompare

[ Source](https://github.com/susanBuck/rock-paper-scissors)[ Packagist](https://packagist.org/packages/susanbuck/rock-paper-scissors)[ RSS](/packages/susanbuck-rock-paper-scissors/feed)WikiDiscussions master Synced today

READMEChangelog (7)DependenciesVersions (8)Used By (0)

Rock Paper Scissors
===================

[](#rock-paper-scissors)

An example package used to demonstrate dependencies in [DGMD E-2 Web Programming for Beginners with PHP](https://hesweb.dev/e2).

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

[](#installation)

```
composer require susanbuck/rock-paper-scissors
```

Usage
-----

[](#usage)

Basic example:

```
require __DIR__.'/vendor/autoload.php';

use RPS\Game;

$game = new Game();

# Each invocation of the `play` method will play and track a new round of player (given move) vs. computer
$game->play('rock');
```

The Game class accepts three constructor parameters:

- `bool $persistResults`
    - Indicates whether or not results should be persisted to the SESSION
    - Defaults to `false`
- `int $maxResults`
    - Indicates the max # of results to record in the SESSION
    - Defaults to `5`
- `string $timezone`
    - Indicates what timezone each round should be recorded in
    - Defaults to `'America/New_York'`

Methods
-------

[](#methods)

`play(String $move): array`
---------------------------

[](#playstring-move-array)

Accepts a string of either `'rock'`, `'paper'`, or `'scissors'`.

Will halt the execution of the program if an invalid move is given.

Returns an array of results:

```
[
    'player' => player's move
    'computer' => computer's move
    'outcome' => outcome (won, lost, tie)
    'timestamp' => timestamp for when the round was played
];

```

`getResults(): array`
---------------------

[](#getresults-array)

Returns an array of the last x results, where x is `$maxResults`.

Returns null if `$persistResults` is set to `false`.

`clearResults(): void`
----------------------

[](#clearresults-void)

Clears the session of results

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity52

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 ~123 days

Recently: every ~185 days

Total

7

Last Release

1653d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/237711?v=4)[Susan Buck](/maintainers/susanbuck)[@susanBuck](https://github.com/susanBuck)

---

Top Contributors

[![susanBuck](https://avatars.githubusercontent.com/u/237711?v=4)](https://github.com/susanBuck "susanBuck (8 commits)")

### Embed Badge

![Health badge](/badges/susanbuck-rock-paper-scissors/health.svg)

```
[![Health](https://phpackages.com/badges/susanbuck-rock-paper-scissors/health.svg)](https://phpackages.com/packages/susanbuck-rock-paper-scissors)
```

###  Alternatives

[kodicms/module-loader

1614.9k11](/packages/kodicms-module-loader)

PHPackages © 2026

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