infocyph/foundation
Composer 安装命令:
composer require infocyph/foundation
包简介
Illuminate-style integration foundation for the Infocyph PHP ecosystem.
README 文档
README
Foundation is the Infocyph application integration layer.
It does not replace the standalone packages. It gives a host project one place to bootstrap config, providers, routing, auth, cache, database, validation, filesystem paths, and runtime wiring.
Install
composer require infocyph/foundation
Optional:
composer require infocyph/talkingbytes
Install TalkingBytes only if you want the talkingbytes notification driver.
Expected Project Structure
Your main app should look like this:
project-root/
app/
bootstrap/
providers.php
config/
app.php
auth.php
cache.php
database.php
database/
public/
index.php
resources/
routes/
web.php
api.php
auth.php
storage/
cache/
logs/
sessions/
uploads/
tests/
composer.json
Foundation already knows these paths by default:
app/bootstrap/config/database/public/resources/routes/storage/storage/cache/storage/logs/storage/sessions/storage/uploads/
Basic Bootstrap
In public/index.php:
<?php declare(strict_types=1); use Infocyph\Foundation\Foundation; require dirname(__DIR__) . '/vendor/autoload.php'; $app = Foundation::local([ 'base_path' => dirname(__DIR__), ]); // Then hand off to your HTTP entry flow.
Use one of these entry modes:
Foundation::local([...])Foundation::production([...])Foundation::api([...])Foundation::create([...])
Config
Foundation loads configuration in this order:
- Foundation defaults
- preset defaults
config/*.php- inline config passed at boot
That means your app config files override the preset, and inline config overrides both.
Example config/app.php:
<?php return [ 'name' => 'My App', 'env' => 'local', 'debug' => true, ];
Example config/auth.php:
<?php return [ 'drivers' => [ 'storage' => 'memory', 'cache' => 'array', 'notifications' => 'collect', 'passkey' => 'memory', ], ];
Providers
Register extra app providers in bootstrap/providers.php:
<?php return [ App\Providers\AppServiceProvider::class, ];
Each provider must implement Foundation's ServiceProviderInterface.
Routes
Foundation auto-loads these files when present:
routes/web.phproutes/api.phproutes/auth.php
Inside a route file, use the injected $router.
Example routes/web.php:
<?php $router->get('/', fn () => 'Hello from Foundation');
Runtime Directories
Your app should have these writable runtime directories:
storage/storage/cache/storage/logs/storage/sessions/storage/uploads/
Local preset can auto-create them. Production should create them ahead of time with correct permissions.
What To Configure First
For a new app, usually start in this order:
base_pathconfig/app.phpconfig/auth.phpconfig/cache.phpconfig/database.phpbootstrap/providers.phproutes/*.php
Production Notes
- Do not keep memory auth storage in production.
- Do not keep simple token drivers in production.
- Configure real database connections before using
dblayer. - Configure real cache stores before using
cachelayer. - If you use
talkingbytes, installinfocyph/talkingbytesand configurenotifications.auth.transport. - If you use WebAuthn, set
auth.webauthn.rp_idandauth.webauthn.origin.
Quick Start Goal
The intended flow is simple:
- Require
infocyph/foundation - Create the standard app folder structure
- Point Foundation at your project root with
base_path - Add config files
- Add providers
- Add route files
- Boot the app from
public/index.php
That is the main host-project shape Foundation expects.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-07-07