Download the PHP package ginv/ginv without Composer

On this page you can find all versions of the php package ginv/ginv. 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 ginv

简介

为什么是ginv

PHP的开源框架已琳琅满目,为什么还要有ginv? 因为ginv和我们往常使用的PHP框架不冲突,它相当于的是这些框架的model层和service层,是作为面向服务编程soa的服务,它解决的是一个复杂项目代码繁乱难以维护的问题. 所以, 通常我们用一个熟练的其他框架来调用各个ginv编写的服务,当然,ginv的各个服务之间也可以相互调用.所以,ginv里面没有专业路由,没有mvc模式.

ginv的优点

  1. 简单易用
  2. 依赖低,速度快
  3. 非orm的sql模板调用,更易优化和维护
  4. 干净好用,ide内无警告

安装和配置

安装

ginv使用 Composer 来管理其依赖性。所以你必须确认在你电脑上是否安装了 Composer。

通过 Composer 在命令行执行 create-project 来安装创建一个demo的服务(项目), 命令如下:

环境需求

配置

ginv 几乎不需配置就可以马上使用。然而某些配置项是为规范和区分不同服务,所以,一般请先查看config/app.php 文件和几个配置文件的的注释说明.

注意: 你不应该在正式环境中将 app.model 配置为 debug。 debug模式是为了在生产环境方便开发者以web方式通过test.php访问调试

权限

ginv 有一个目录temp 要让服务器有写入的权限。

web服务器配置

ginv在web服务器配置伪静态后, 我们通过几个地址参数来进行访问的确定

  1. 版本号参数, 为了实现多个版本接口共存,第一个参数确定服务的版本,即api目录下的版本目录.
  2. 服务类, 版本号目录下对应的php类类名
  3. 服务方法,对应方法名

例如: web访问地址:http://localhost:8080/v1/test/index, 版本号是v1,服务类名是test,方法名是index

rpc方法调用有所不同

我们在config/server.php添加一个配置

此时,在另外一个服务可以通过rpc('demo','test')->call('index')调用

Nginx

在 Nginx,在你的网站配置中增加下面的配置:

函数

ginv的助手函数非常少

config

config函数用户获取一个配置:

db

db 函数启用数据库连接并实例化db类

redis_key

redis_key 函数用于读取config/redis_key.php的配置,若有第二个参数,根据第二个参数进行格式化

redis

redis函数启用redis连接并实例化redis类

base_path

base_path 函数获取相对于项目根目录的完整路径

dd

dd 函数用于打印并中断程序执行

数据查询

调用另外一个服务的数据

$this->rpc(服务名,服务类)->call(服务函数[,函数参数1[, 函数参数2...]]);

服务名在配置文件config/service.php配置

查询数据库数据

数据库查询最常用的函数如下:

函数 说明
query 查询多条记录
queryRow 查询单条记录
exec 执行一条 SQL 语句,并返回受影响的行数
count count查询快捷返回函数
其他数据库的函数: 函数 说明
lastInsertId 插入查询后,获取最后插入的id
begin 启动事务
commit 提交事务
rollBack 回滚事务
sql 获取sql语句

ginv的一个简单例子

template目录下blog.blade.php文件中sql模板如下:


All versions of ginv with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1.16 || ^7.2.4
ginv/framework Version ^1.0
ext-json Version *
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 ginv/ginv contains the following files

Loading the files please wait ....