PHPackages                             simon-downes/spf-contracts - 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. [PSR &amp; Standards](/categories/psr-standards)
4. /
5. simon-downes/spf-contracts

ActiveLibrary[PSR &amp; Standards](/categories/psr-standards)

simon-downes/spf-contracts
==========================

Defines the interfaces and traits for the services used throughout SPF

056PHP

Since Jul 23Pushed 8y agoCompare

[ Source](https://github.com/simon-downes/spf-contracts)[ Packagist](https://packagist.org/packages/simon-downes/spf-contracts)[ RSS](/packages/simon-downes-spf-contracts/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

SPF Contracts
=============

[](#spf-contracts)

Introduction
------------

[](#introduction)

This package defines the interfaces and traits for the core services used throughout SPF. e.g. `spf\contracts\database\DatabaseConnection`defines the contract for accessing a database, while the `spf\contracts\support\collections\Dictionary` defines methods for operating on a collection of key/value pairs.

Each directory corresponds to a SPF package that provides implementations of the interfaces defined in that directory. For example, the `simon-downes/spf`package contains implementions of `spf\contracts\log\Logger`.

Naming Conventions
------------------

[](#naming-conventions)

Interfaces in this package are named in one of two ways:

- As a singular noun (e.g. `Dictionary`, `DatabaseConnection`, `Filter`)
- As a noun or verb suffixed with "-able" (e.g. `Arrayable`, `Runnable`)

The implementations of those interfaces within SPF packages are prefixed with `Base`.

- `Dictionary` ➡ `BaseDictionary`
- `DatabaseConnection` ➡ `BaseConnection`
- `ConnectionManager` ➡ `BaseConnectionManager`
- `Profiler` ➡ `BaseProfiler`

Background
----------

[](#background)

This package is based on [gamernetwork/yolk-contracts](https://www.github.com/gamernetwork/yolk-contracts). For more information on the history and relationship between Yolk and SPF please see the README of [simon-downes/spf-core](https://www.github.com/simon-downes/spf-core).

Why Contracts?
--------------

[](#why-contracts)

A separate contracts package provides two primary benefits:

- A quick reference point for all available contracts.
- A single, decoupled package that promotes loose-coupling by separating interfaces from implementations.

### Quick Reference

[](#quick-reference)

Having all of the framework's services neatly defined within interfaces provides succinct documentation to available features.

Rather than tracking down which methods are available within a large, complicated class, you can refer to a simpler, cleaner interface.

### Loose Coupling

[](#loose-coupling)

[Wikipedia Reference](https://en.wikipedia.org/wiki/Loose_coupling)

SPF packages provide default and usually basic implementations of each contract; sometimes these might not be sufficient or quite right for a particular project.

By specifying contracts, code is no longer coupled to these specific implementations and you may easily write alternatives that better suit your project.

Likewise, you can switch between implementations without modifying any consuming code. The classic example being able to switch caching backends (e.g. Memory/Redis/Memcache) without modifying any code that uses the cache.

###  Health Score

21

—

LowBetter than 17% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1052903?v=4)[Simon Downes](/maintainers/simon-downes)[@simon-downes](https://github.com/simon-downes)

---

Top Contributors

[![simon-downes](https://avatars.githubusercontent.com/u/1052903?v=4)](https://github.com/simon-downes "simon-downes (12 commits)")

### Embed Badge

![Health badge](/badges/simon-downes-spf-contracts/health.svg)

```
[![Health](https://phpackages.com/badges/simon-downes-spf-contracts/health.svg)](https://phpackages.com/packages/simon-downes-spf-contracts)
```

###  Alternatives

[symfony/translation-contracts

Generic abstractions related to translation

2.6k765.3M755](/packages/symfony-translation-contracts)[pimple/pimple

Pimple, a simple Dependency Injection Container

2.7k135.7M1.5k](/packages/pimple-pimple)[mpdf/psr-log-aware-trait

Trait to allow support of different psr/log versions.

6442.1M14](/packages/mpdf-psr-log-aware-trait)[nikolaposa/phoundation

Facilitates the routine step of bootstrapping PHP applications.

179.0k](/packages/nikolaposa-phoundation)

PHPackages © 2026

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