GithubHelp home page GithubHelp logo

gini's Introduction

Gini PHP Framework

Gini Logo

Gini 是一个基于松散模块依赖的MVC PHP框架,深受Kohana, Symphony和Composer的影响。

点击这里进入GitBook阅读具体文档

可用的Gini模块

易用的CLI

Gini 在命令行下提供了一个 gini 命令, 和 composernpm 类似. 你能够很容易的通过少数几条命令创建CLI的应用,然后通过 gini foo bar 的方式调用.

面向对象

Gini PHP framework 基于 PHP 5 OO. 现在难道还有 PHP 框架不是 OO 的吗?

兼容 Composer

你可以通过 Composer 来加装 Gini, 也可以独立使用 Gini, 又或者在 Gini 框架中直接使用各种 Composer 第三方模块.

Those ORM

这是一个内建的 ORM 实现, 方便大家采用 OO 的方式访问数据库. Database SQL 层完全被封装成了对象。 你可以像定义类一样的方式定义你的数据库表结构。当你实例化对象并赋值属性,然后使用 save 方法时,系统会自动将对象的属性保存在数据表中。

同时, Those ORM 提供了有趣的符合自然语义的语法来完成原本枯燥的SQL实现 (实验中...)。 以下是个示例:

// 查询所有名字以'J'开头, 爸爸的email中存在genee的用户
$users = those('users')
    ->whose('name')->beginWith('J')
    ->andWhose('father')->isIn(
        those('users')->whose('email')->contains('genee')
    );

内建 JSON-RPC 和 REST 的 API 与远程调用支持

以下是个示例:

  1. JSON-RPC
// Client
$rpc = new \Gini\RPC('http://gini/api');
$sum = $rpc->hello->add(1, 2);

//Server
class Hello extends \Gini\Controller\API {
    public function actionAdd($a, $b) {
        return $a + $b;
    }
}
  1. REST
// Client
$rest = new \Gini\REST('http://localhost/rest');
$sum = $rest->post('add', ['a'=>1, 'b'=>2]);

// Server
class Hello extends \Gini\Controller\REST {
    public function postAdd($a, $b) {
        return $a + $b;
    }
}

gini's People

Contributors

huangstomach avatar huihui2018 avatar iamfat avatar kingofpowers avatar leejinlin avatar leoparddennis avatar oakfire avatar pihizi avatar rayyh avatar txw-yates avatar unpc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gini's Issues

如果在gini index publish的时候输入凭证 就会500

root@24fc847d212f:/data/gini-modules/bzmc-gateway# gini index publish 0.1.0
NOTICE: You are currently executing commands without cache!

Publishing bzmc-gateway/0.1.0...

User: jipeng.huang
Password:

Error: 500
root@24fc847d212f:/data/gini-modules/bzmc-gateway# gini index login
NOTICE: You are currently executing commands without cache!

User: jipeng.huang
Password:
You've successfully logged in as jipeng.huang.

这是终端输出 如果我在使用gini index publish命令的时候就会抛出500错误
正常分步登陆没有问题

gini web update 命令中 less转换出现问题

具体原因详见 less issues#974

我们在引入某些第三方ui框架如bootstrap或自己进行某些计算式height: calc(2.25rem + 2px);的时候

less会将height: calc(2.25rem + 2px);直接转换为height: 4.25rem

根据issue所示,可以通过将class/Gini/Controller/CLI/Web.php55行左右:

$command = sprintf(
    'lessc %s %s %s',
    escapeshellarg($src_path),
    escapeshellarg($dst_path),
    '--clean-css="--s1 --advanced --compatibility=ie8"'
        );
exec($command);

修改为

$command = sprintf(
    'lessc %s %s %s',
    escapeshellarg($src_path),
    escapeshellarg($dst_path),
    '--clean-css="--s1 --advanced --compatibility=ie8" --strict-math=on'
        );
exec($command);

就可以正常的解析,是否考虑增加web update的参数还是直接加入框架中?

依照gini-book的安装步骤中进行gini框架安装时提示错误

依照gini-book的安装步骤中进行gini框架安装时提示错误

 Packing view...
    PHP: error/404.phtml... 88.3%
    PHP: error/401.phtml... 88.1%
    PHP: body.phtml... 90.3%
    PHP: layout.phtml...PHP Fatal error:  Class 'CssMin' not found in /home/vagrant/gini-modules/gini/lib/obfuscator.php on line 525

在配置的 GINI_ENV 的情况下, 数组类型配置叠加时, GINI_ENV 配置应在默认配置的前面

在配置了 GINI_ENV 的情况下, 如果有数组类型的配置, GINI_ENV 的配置在默认配置的后面.

通常如果我们使用的 GINI_ENV, 会加载 GINI_ENV 下的配置, 但是加载后, 配置会叠加在默认配置的后面, 这样引发的问题是, GINI_ENV 的配置有可能压根用不上.

在其他的一些项目中, 如果 runmode = dev, 那么 [dev] 下的配置会直接覆盖默认的配置.

为何此处不这么使用呢 ?

router路由匹配问题

发现如果定义router为

$router->post('a/b/{id}', 'A@b');

参数列表为

function b ($id) { }

将参数写入url进行post提交的时候一切正常
但使用 form-data 参数为 { 'id': 1 } 提交至a/b时则无法匹配到相应路由
如果url随便写占用{id}的位置时 如 a/b/sth 则可以正常匹配

另外如果我为了捕获跟路由写出

$router->('/', 'class@action');

则除非我重新定义全部路由 否则没有定义的路由均会被该条路由规则拦截
是否设计如此?

gini orm update

[E] Can't create table gapper.#sql-92_7 (errno: 150 "Foreign key constraint is incorrectly formed")
创建表的时候,由于外键的问题,需要有明确的建表顺序,不能太随意

是否可以增加不必须带有id和extra属性的功能?

其中有部分ORM其实是不需要extra字段和id字段
但是代码中很多地方又强依赖了这些字段比如Object的fetch方法:

    public function fetch($force = false)
    {
        if ($this->criteria() === null && $this->those) {
            //try those API
            $ids = (array) $this->those->limit(1)->get('id');
            $this->criteria(reset($ids));
        }

        return parent::fetch($force);
    }

是否可以提供一种属性值unset或者另一个可供继承的类比如PureObject之类来节省不必要的字段?

Gini的Composer兼容性不好

目前每个Gini模块i里面都会尝试加载自己的Composer模块
当不同的Gini模块里面存在同样的Composer模块的话
这样就会混乱的,所以我倾向于将现在gini-modules里面的composer.json信息移到gini.json中
然后再gini update的时候, 尝试合并所有依赖模块的composer信息在终端gini模块自动生成composer.json然后进行更新, 这样可以避免重复的问题

@unpc @stenote @pihizi @leejinlin @liyu001989

composer create-project iamfat/gini 后不可用

尝试执行命令:

composer create-project iamfat/gini

然后php bin/gini 提示错误信息

PHP Fatal error:  Call to undefined function Gini\yaml_parse() in /home/may/foo/foo/class/Gini/Config.php on line 102

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.