Download the PHP package aaronjan/academe without Composer

On this page you can find all versions of the php package aaronjan/academe. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package academe

Academe


功能特性

Academe 是一个实用的 Data Mapper,有以下特性:

安装

需要mongodb扩展支持(>= 1.3)。

使用Composer安装:

快速上手

安装

Academe 自带 Laravel 支持,以下以 Laravel 使用为例。

安装好之后,执行命令导入配置文件到 config/academe.php

配置文件默认兼容 Laravel .env 中的数据库配置。

如果你的 Laravel 版本低于 5.5,那么还需要将 AcademeServiceProvider 加入到 config/app.php中。

生成第一个 Blueprint

你需要使用 Blueprint 来定义和使用数据。

例如有一个 MySQL 表:

运行命令生成 Blueprint

说明:MySQL 的 table 或者 MongoDB 的 Collection 在 Academe 中统一称作 Subject

打开刚生成的 Blueprint(默认路径:app/Academe/Blueprints/User),增加字段类型配置(位于 castRules()):

编写查询

定义好 Blueprint 之后,就可以通过 依赖注入 的方式拿到 Mapper 来进行和数据库之间的交互了:

所有数据操作都可以通过调用 Mapper 上的 query() 方法完成(所有数据库通用),部分 MongoDB 专有方法可以通过 queryAsMongoDB()完成。

独立生成查询条件

除了通过 Mapper 上的 query() 方法组织查询条件,还可以通过 Writer 生成条件,这适用于很多需要由某个函数生成部分或全部查询条件的情况:

Group

Academe 同样支持 group by 类统计查询(MongoDB 同样支持),使用方式如下:

数据关系

数据关系的定义同样是写在 Blueprint 中的:

查询关系数据的方式和 Laravel 基本一致:

Academe 目前支持定义两种数据关系:一对一、一对多和多对多,其中又分为几种变体:

一对一

一对多

多对多

多对多因为需要一张中间表,所以也需要定义中间表的 Blueprint:Bond。运行 Artisan 命令进行生成:

生成文件如下:

事务

事务是围绕 Transaction 对象展开的,以下是实例:

事务操作目前对 MongoDB 是无效的,等到 MongoDB 4.0 正式发布之后会考虑提供支持。

MongoDB

$elemMatch

TODOs

Credits

Laravel

Opulence

Waterline

Laravel MongoDB

Ran Ding


All versions of academe with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0.0
doctrine/dbal Version ~2.5
mongodb/mongodb Version >=1.3,<1.5
nesbot/carbon Version >=1.0
brick/math Version >=0.5,<0.8
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package aaronjan/academe contains the following files

Loading the files please wait ....