Skip to content

Commit

Permalink
Merge branch 'master' into crud
Browse files Browse the repository at this point in the history
  • Loading branch information
xepozz committed Jun 9, 2024
2 parents c02a72b + 43a49e2 commit a56ee0e
Show file tree
Hide file tree
Showing 60 changed files with 265 additions and 366 deletions.
1 change: 0 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
| Is bugfix? | ✔️/❌
| New feature? | ✔️/❌
| Breaks BC? | ✔️/❌
| Fixed issues | comma-separated list of tickets # fixed by the PR, if any
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Yii Framework Gii extension Change Log
# Yii Gii extension Change Log

## 1.0.0 under development

Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright © 2008 by Yii Software (https://www.yiiframework.com/)
Copyright © 2008 by Yii Software (<https://www.yiiframework.com/>)
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
56 changes: 40 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
<p align="center">
<a href="https://github.com/yiisoft" target="_blank">
<img src="https://yiisoft.github.io/docs/images/yii_logo.svg" height="100px">
<img src="https://yiisoft.github.io/docs/images/yii_logo.svg" height="100px" alt="Yii">
</a>
<h1 align="center">Gii Extension for Yii</h1>
<br>
</p>

This extension provides a Web-based code generator, called Gii, for [Yii framework](https://www.yiiframework.com) applications.
You can use Gii to quickly generate models, forms, modules, CRUD, etc.

For license information check the [LICENSE](LICENSE.md)-file.

Documentation is at [docs/guide/README.md](docs/guide/README.md).

[![Latest Stable Version](https://poser.pugx.org/yiisoft/yii-gii/v/stable.png)](https://packagist.org/packages/yiisoft/yii-gii)
[![Total Downloads](https://poser.pugx.org/yiisoft/yii-gii/downloads.png)](https://packagist.org/packages/yiisoft/yii-gii)
[![Build Status](https://github.com/yiisoft/yii-gii/workflows/build/badge.svg)](https://github.com/yiisoft/yii-gii/actions?query=workflow%3Abuild)
Expand All @@ -21,18 +14,22 @@ Documentation is at [docs/guide/README.md](docs/guide/README.md).
[![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fyiisoft%2Fyii-gii%2Fmaster)](https://dashboard.stryker-mutator.io/reports/github.com/yiisoft/yii-gii/master)
[![static analysis](https://github.com/yiisoft/yii-gii/workflows/static%20analysis/badge.svg)](https://github.com/yiisoft/yii-gii/actions?query=workflow%3A%22static+analysis%22)

This extension provides a Web-based code generator, called Gii, for [Yii framework](https://www.yiiframework.com) applications.
You can use Gii to quickly generate models, forms, modules, CRUD, etc.

## Requirements

- PHP 8.1 or higher.

Installation
------------
## Installation

The preferred way to install this extension is through [composer](https://getcomposer.org/download/).
The package could be installed with [Composer](https://getcomposer.org):

```shell
composer require yiisoft/yii-gii
```

Usage
-----
## General usage

Once the extension is installed, simply modify your application configuration as follows:

Expand All @@ -51,20 +48,20 @@ return [

You can then access Gii through the following URL:

```
```text
http://localhost/path/to/index.php?r=gii
```

or if you have enabled pretty URLs, you may use the following URL:

```
```text
http://localhost/path/to/index.php/gii
```

Using the same configuration for your console application, you will also be able to access Gii via
command line as follows,

```
```shell
# change path to your application's base path
cd path/to/AppBasePath

Expand All @@ -77,3 +74,30 @@ yii help gii/model
# generate City model from city table
yii gii/model --tableName=city --modelClass=City
```

## Documentation

- Guide: [English](docs/guide/en/README.md), [Português - Brasil](docs/guide/pt-BR/README.md), [Русский](docs/guide/ru/README.md), [日本語](docs/guide/ja/README.md), [中国人](docs/guide/zh-CN/README.md)
- [Internals](docs/internals.md)

If you need help or have a question, the [Yii Forum](https://forum.yiiframework.com/c/yii-3-0/63) is a good place for that.
You may also check out other [Yii Community Resources](https://www.yiiframework.com/community).

## License

The Gii Extension for Yii is free software. It is released under the terms of the BSD License.
Please see [`LICENSE`](./LICENSE.md) for more information.

Maintained by [Yii Software](https://www.yiiframework.com/).

## Support the project

[![Open Collective](https://img.shields.io/badge/Open%20Collective-sponsor-7eadf1?logo=open%20collective&logoColor=7eadf1&labelColor=555555)](https://opencollective.com/yiisoft)

## Follow updates

[![Official website](https://img.shields.io/badge/Powered_by-Yii_Framework-green.svg?style=flat)](https://www.yiiframework.com/)
[![Twitter](https://img.shields.io/badge/twitter-follow-1DA1F2?logo=twitter&logoColor=1DA1F2&labelColor=555555?style=flat)](https://twitter.com/yiiframework)
[![Telegram](https://img.shields.io/badge/telegram-join-1DA1F2?style=flat&logo=telegram)](https://t.me/yii3en)
[![Facebook](https://img.shields.io/badge/facebook-join-1DA1F2?style=flat&logo=facebook&logoColor=ffffff)](https://www.facebook.com/groups/yiitalk)
[![Slack](https://img.shields.io/badge/slack-join-1DA1F2?style=flat&logo=slack)](https://yiiframework.com/go/slack)
22 changes: 17 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,23 @@
],
"license": "BSD-3-Clause",
"support": {
"issues": "https://github.com/yiisoft/yii-gii/issues?state=open",
"source": "https://github.com/yiisoft/yii-gii",
"issues": "https://github.com/yiisoft/yii-gii/issues",
"forum": "https://www.yiiframework.com/forum/",
"wiki": "https://www.yiiframework.com/wiki/",
"irc": "irc://irc.freenode.net/yii",
"irc": "ircs://irc.libera.chat:6697/yii",
"chat": "https://t.me/yii3en"
},
"funding": [
{
"type": "opencollective",
"url": "https://opencollective.com/yiisoft"
},
{
"type": "github",
"url": "https://github.com/sponsors/yiisoft"
}
],
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
Expand All @@ -29,7 +39,7 @@
"yiisoft/http": "^1.2",
"yiisoft/hydrator": "^1.0",
"yiisoft/injector": "^1.1",
"yiisoft/input-http": "dev-master",
"yiisoft/input-http": "^1.0",
"yiisoft/json": "^1.0",
"yiisoft/router": "^3.0",
"yiisoft/strings": "^2.1",
Expand All @@ -45,8 +55,9 @@
"roave/infection-static-analysis-plugin": "^1.23",
"spatie/phpunit-watcher": "^1.23",
"vimeo/psalm": "^5.13",
"yiisoft/active-record": "^3.0@dev",
"yiisoft/active-record": "dev-master",
"yiisoft/cache": "^3.0",
"yiisoft/db": "1.2 as dev-master",
"yiisoft/db-sqlite": "^1.0",
"yiisoft/di": "^1.1",
"yiisoft/dummy-provider": "^1.0",
Expand Down Expand Up @@ -88,7 +99,8 @@
"sort-packages": true,
"allow-plugins": {
"infection/extension-installer": true,
"composer/package-versions-deprecated": true
"composer/package-versions-deprecated": true,
"php-http/discovery": false
}
},
"scripts": {
Expand Down
12 changes: 8 additions & 4 deletions config/di.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Yiisoft\Injector\Injector;
use Yiisoft\Yii\Gii\GeneratorInterface;
use Yiisoft\Yii\Gii\GeneratorProxy;
use Yiisoft\Yii\Gii\Gii;
use Yiisoft\Yii\Gii\GiiInterface;
use Yiisoft\Yii\Gii\ParametersProvider;
Expand All @@ -14,18 +15,21 @@

return [
GiiInterface::class => function (Injector $injector) use ($params): GiiInterface {
$generatorsInstances = [];
$proxies = [];
$generators = $params['yiisoft/yii-gii']['generators'];

foreach ($generators as $generator) {
$class = $generator['class'];
/**
* @var $loader Closure(): GeneratorInterface
*/
$loader = fn() => $injector->make($class, $generator['parameters'] ?? []);
$generatorsInstances[$class] = $loader;
$loader = new GeneratorProxy(
fn() => $injector->make($class, $generator['parameters'] ?? []),
$class,
);
$proxies[$class::getId()] = $loader;
}
return new Gii($generatorsInstances);
return new Gii($proxies, []);
},
ParametersProvider::class => [
'class' => ParametersProvider::class,
Expand Down
4 changes: 4 additions & 0 deletions config/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Psr\Http\Message\ResponseFactoryInterface;
use Yiisoft\Csrf\CsrfMiddleware;
use Yiisoft\DataResponse\Middleware\FormatDataResponseAsJson;
use Yiisoft\RequestProvider\RequestCatcherMiddleware;
use Yiisoft\Router\Group;
use Yiisoft\Router\Route;
use Yiisoft\Validator\ValidatorInterface;
Expand Down Expand Up @@ -47,14 +48,17 @@ static function (ResponseFactoryInterface $responseFactory, ValidatorInterface $
->name('generator'),
Route::post('/{generator}/preview')
->middleware(BodyParamsMiddleware::class)
->middleware(RequestCatcherMiddleware::class)
->action([DefaultController::class, 'preview'])
->name('preview'),
Route::post('/{generator}/generate')
->middleware(BodyParamsMiddleware::class)
->middleware(RequestCatcherMiddleware::class)
->action([DefaultController::class, 'generate'])
->name('generate'),
Route::post('/{generator}/diff')
->middleware(BodyParamsMiddleware::class)
->middleware(RequestCatcherMiddleware::class)
->action([DefaultController::class, 'diff'])
->name('diff')
)
Expand Down
Binary file removed docs/guide-pt-BR/images/gii-entry.png
Binary file not shown.
Binary file removed docs/guide-pt-BR/images/gii-preview.png
Binary file not shown.
20 changes: 0 additions & 20 deletions docs/guide-ru/README.md

This file was deleted.

Binary file removed docs/guide-ru/images/gii-entry.png
Binary file not shown.
Binary file removed docs/guide-ru/images/gii-preview.png
Binary file not shown.
20 changes: 0 additions & 20 deletions docs/guide-uk/README.md

This file was deleted.

46 changes: 0 additions & 46 deletions docs/guide-uk/basic-usage.md

This file was deleted.

Binary file removed docs/guide-uk/images/gii-entry.png
Binary file not shown.
Binary file removed docs/guide-uk/images/gii-preview.png
Binary file not shown.
58 changes: 0 additions & 58 deletions docs/guide-uk/installation.md

This file was deleted.

Loading

0 comments on commit a56ee0e

Please sign in to comment.