atsmacode/framework
最新稳定版本:v2.0.12
Composer 安装命令:
composer create-project atsmacode/framework
包简介
Repo with base DB, Model and Config resources
README 文档
README
I created this repository to provide some basic resources for use in other packages I've been working on.
It essentially consists of the following:
- Commands for migrations
- Container based database connections
- Model classes
This is intended for my own personal use.
Environment
PHP
8.1.3
MySQL
8.0.13
Commands
Linux
Run the unit test suite:
dev/phpunit
Windows
Run the unit test suite:
.\dev\runtests.bat
Usage
The example configs and migrations are included mainly as examples of how I am currently using this framework.
Migrator
You can use the base Migrator to migrate any set of classes. The CreateDatabase class included can be used to drop/create a DB.
In the ExampleMigrator, a Laminas\ServiceManager\ServiceManager is passed into the constructor. It has a DB connection set in the dependency map using app/FrameworkConfigProvider.php.
The base app/Console/Commands/Migrator.php looks for the Atsmacode\Framework\Database\ConnectionInterface and uses the given DB credentials for all migrations.
This interface is also used for the Model DB connections throughout a request lifecycle.
You can then run a command like so (-d true is for the 'test' DB credentials in the config array, remove this for 'live' DB):
php dev/SymfonyApplication.php app:build-framework -d true
A standalone command to create a DB is provided (you can add it to the SymfonyApplication in the same way as the ExampleMigrator):
app/Console/Commands/CreateDatabase.php
php dev/SymfonyApplication.php app:create-database -d true
Configs
You need to add framework.php to configure your local DB credentials, like so:
<?php
return [
'framework' => [
'db' => [
'live' => [
'servername' => 'localhost',
'username' => 'DB_USER',
'password' => 'DB_PASSWORD',
'database' => 'framework',
'driver' => 'pdo_mysql',
],
'test' => [
'servername' => 'localhost',
'username' => 'DB_USER',
'password' => 'DB_PASSWORD',
'database' => 'framework_test',
'driver' => 'pdo_mysql',
],
]
]
];
atsmacode/framework 适用场景与选型建议
atsmacode/framework 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 153 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 12 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 atsmacode/framework 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 atsmacode/framework 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 153
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 7
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2022-12-03