PHPackages                             phpfasty/core - 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. phpfasty/core

ActiveLibrary

phpfasty/core
=============

Reusable runtime and infrastructure abstractions for PHP apps

v1.0.0(1mo ago)01↓100%GPL-3.0-or-laterPHPPHP &gt;=8.4

Since Mar 20Pushed 1mo agoCompare

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

READMEChangelog (1)DependenciesVersions (2)Used By (0)

phpfasty/core
=============

[](#phpfastycore)

Reusable runtime primitives for small PHP applications that want a clean boundary between shared infrastructure and app-specific behavior.

This package was extracted from a real FlightPHP-based application, but it is kept intentionally framework-light. It does not force a template engine, does not hardcode supported locales, and does not contain app-specific routes, content, or business rules.

Repository: [github.com/phpfasty/core](https://github.com/phpfasty/core.git)

Why
---

[](#why)

Most small PHP projects start simple, then slowly accumulate framework glue, template engine assumptions, hardcoded language logic, and deployment-specific helpers in the same repository.

That works for one site, but it becomes painful when you want to:

- publish the reusable runtime as a package
- build multiple sites on top of the same foundation
- keep templates, routes, fixtures, and UI decisions inside each app
- swap Latte for Twig or another renderer later
- define supported locales in the application instead of the core
- keep deployment predictable with a very small surface area in `vendor/`

`phpfasty/core` exists to keep the shared part small and stable:

- container and bootstrap
- cache storage
- data provider contracts
- renderer contract
- locale contracts
- simple security header middleware

Everything opinionated stays in the consuming application.

What This Package Includes
--------------------------

[](#what-this-package-includes)

- `Application`: tiny application bootstrap wrapper
- `Container`, `ContainerInterface`: simple service container
- `BootableServiceInterface`: contract for services that should boot on startup
- `CacheStore`: file-based HTML/string cache
- `DataProviderInterface`: content source contract
- `FixtureDataProvider`: JSON fixture provider with locale-aware fallback
- `TemplateRendererInterface`: rendering contract, engine-agnostic
- `LocaleResolverInterface`: locale normalization contract
- `LocaleAwareInterface`: contract for services that accept locale updates
- `SecurityHeaders`: minimal response header middleware

What This Package Deliberately Does Not Include
-----------------------------------------------

[](#what-this-package-deliberately-does-not-include)

- no routing layer
- no template engine implementation
- no hardcoded supported locales
- no `.env` loading
- no request-defense logic
- no app-specific pages, controllers, templates, or fixtures

That boundary is intentional.

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

[](#installation)

If the package is available through Packagist:

```
composer require phpfasty/core
```

If you want to consume it directly from GitHub before publishing to Packagist:

```
{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/phpfasty/core.git"
    }
  ],
  "require": {
    "phpfasty/core": "^1.0"
  }
}
```

Design Principles
-----------------

[](#design-principles)

### 1. Small shared surface

[](#1-small-shared-surface)

Only generic runtime building blocks belong here.

### 2. Application owns behavior

[](#2-application-owns-behavior)

The application decides:

- which renderer to use
- which locales are supported
- where content comes from
- which routes exist
- what HTML should be rendered

### 3. Contracts over implementations

[](#3-contracts-over-implementations)

The core provides interfaces where the app may need to vary behavior later.

### 4. Simple deployment

[](#4-simple-deployment)

The package is intentionally plain PHP with minimal assumptions, which makes it easy to ship in committed `vendor/`, Docker images, or small PaaS deployments.

Quick Start
-----------

[](#quick-start)

### 1. Create a services file

[](#1-create-a-services-file)

```
