thephprame/thephprame-core
最新稳定版本:v1.0.5
Composer 安装命令:
composer require thephprame/thephprame-core
包简介
Core of the phprame framework
关键字:
README 文档
README
Core utilities and base classes for the phprame PHP micro-framework.
This package contains the core building blocks used by thephprame applications: base controller and model classes, HTTP request/response wrappers, routing helpers, middleware base, and lightweight helpers for files, cookies, encryption and database access.
Key Features
- Minimal, framework-agnostic helpers for small apps
- Base classes: controllers, models and middleware
- Request/Response and routing support
- Small utility helpers: Files, Cookies, Encryption, Database
Installation
If the package is available via Composer (packagist):
composer require thephprame/thephprame-core
For local development (when using this repo as a local package), add a path repository to your application's composer.json and require the package by name:
"repositories": [ { "type": "path", "url": "../local-packages/thephprhame-core" } ]
Then run composer require thephprame/thephprame-core in your application.
Quick Usage
These examples illustrate common patterns — adapt them to your app structure.
Controllers
Extend the base controller to create action methods used by routes:
class HomeController extends Controller { public function index() { return Response::view('home', ['name' => 'world']); } }
Models
Create models by extending Model for simple DB interactions:
class User extends Model { protected $table = 'users'; } $user = (new User())->find(1);
Routing
Register routes using the Routes helper (see the application's Routes files):
Routes::get('/', [HomeController::class, 'index']); Routes::post('/api/items', [ItemController::class, 'store']);
Request / Response
Use Request to access input and Response to send responses:
$name = Request::input('name', 'guest'); return Response::json(['hello' => $name]);
Utility Classes (brief)
Controller— base controller classModel— base model with simple DB helpersRoutes— route registration helpersRequest/Response— HTTP wrappersMiddleware— base middleware classDatabase/DatabaseHelper— DB connection and helpersEncryption— encryption utilitiesFile/Files— file helpersCookie/Cookies— cookie helpersIException— core exception interface
Contributing
Contributions are welcome. Please open issues or pull requests against the repository. Keep changes focused and include tests/examples where appropriate.
License
The package is distributed under the MIT License. See the composer.json for license metadata.
Authors
See composer.json authors field for package authors.
统计信息
- 总下载量: 19
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-12-21