定制 mamift/redbean4-laravel5 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mamift/redbean4-laravel5

Composer 安装命令:

composer require mamift/redbean4-laravel5

包简介

A Laravel 5 and Lumen compatible service provider for Redbean 4

README 文档

README

A Laravel 5 and Lumen-compatible service provider package for RedBeanPHP ORM 4.3.

NOTE: This is not Laravel 4 compatible.

This is a Laravel 5 and Lumen-compatible package to allow the use of Redbean PHP ORM, version 4.3.

License - GPL2

As redbeanPHP is itself licensed under GPL2, so is this package.

Please refer to the GPL 2 license here.

Pre-requisites for Lumen

In Lumen, you must enable dotenv as it is disabled by default in new Lumen installations (uncomment this line inside app.php):

Dotenv::load(__DIR__.'/../');

Also you must configure a default .env file in both Laravel and Lumen with database connection settings. As a minimum you must have the following settings configured:

DB_CONNECTION=
DB_HOST=
DB_DATABASE=
DB_USERNAME=
DB_PASSWORD=

DB_CONNECTION determines what type of database you're using (mysql or postresql or whatever)
DB_HOST is the name or IP of the database server
DB_DATABASE is the name of the database
DB_USERNAME is the username used to the connect to the database
DB_PASSWORD is the password for the DB_USERNAME

How to install

Add this line

"mamift/redbean4-laravel5":"dev-master" 

to your composer.json file. Then run composer update in your Lumen or Laravel app directory.

For Lumen

Add this line:

$app->register('Mamift\Redbean4Laravel5\RedbeanProvider');

to app.php inside the bootstrap/ folder, so RedBeanPHP is setup using Lumen's database settings.

For Laravel 5

Add this line

\Mamift\Redbean4Laravel5\RedbeanProvider::class,

to the providers array inside config/app.php.

For both Lumen and Laravel, RedBeanPHP will register it's own facade class ("R"), and you can begin using Redbean using the 'R::' prefix.

Usage

Read RedBeanPHP's documentation for a complete overview of what you can do with RedBean. Because this package includes the full rb.php file unmodified, every programmable interface listed on RedBean's API documentation pages should be usable.

An example:

$user = R::dispense('user');
$user['description'] = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis";
$user->username = "mamift";
$user->gender = R::enum('gender:male');
R::store($user);

A note on how this package exposes RedBean in Laravel

What this package does is load rb.php for each request. Under the "autoload" JSON object inside composer.json, rb.php is specified as part of the "files" array:

{
    "autoload": {
	    "files": [
	        "src/rb.php"
	    ]
	}
}

A quote from the Composer documentation says:

If you want to require certain files explicitly on every request then you can use the 'files' autoloading mechanism. This is useful if your package includes PHP functions that cannot be autoloaded by PHP.

Due to rb.php being loaded on each request, there may be a slight performance penalty incurred.

mamift/redbean4-laravel5 适用场景与选型建议

mamift/redbean4-laravel5 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 76 次下载、GitHub Stars 达 2, 最近一次更新时间为 2015 年 05 月 06 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 mamift/redbean4-laravel5 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 mamift/redbean4-laravel5 我们能提供哪些服务?
定制开发 / 二次开发

基于 mamift/redbean4-laravel5 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 76
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 18
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-05-06