定制 spaceboy/datex 二次开发

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

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

spaceboy/datex

Composer 安装命令:

composer require spaceboy/datex

包简介

Simple command line tool for easy creating PHP entity, form and model classes in Nette PHP framework

README 文档

README

Simple command line tool for rapid development of database-related routines work (creating entity, form and model PHP classes/files) under PHP/Nette framework environment.

1 Installation

1.1 Install tool

In command line, type

>composer require spaceboy/datex

1.2 Copy script file

Copy file datex.php from

APP_ROOT/vendor/spaceboy/datex/bin/datex.php

to

APP_ROOT/app/bin/datex.php

1.3 Register service DatexModel

In APP_ROOT/config/services.neon add service into service list:

services:
	- Spaceboy\Datex\DatexModel(%datex%)

2 Configuration

2.1 Add configuration parameters

In APP_ROOT/config/services.neon add datex section into parameters:

parameters:
	datex:
		entity:
			namespace: App\Model\Entities
			path: app/model/entities
			template: templateEntity.phtml
		form:
			namespace: App\Forms
			path: app/forms
			template: templateForm.phtml
		model:
			namespace: App\Model
			path: app/model/models
			template: templateModel.phtml

2.2 Connect to database

Before first run, make sure your database connection is correctly set.

In database section of your config file (APP_ROOT/config/local.neon or APP_ROOT/config/common.neon) should be your DB connection described somehow like that:

database:
	dsn: 'mysql:host=127.0.0.1;dbname=my_database'
	user: db_user
	password: *****

Use script

In command line terminal, go to the APP_ROOT/bin directory and try very first run:

>php datex.php

If anything goes wrong, clear the cache and try again.

Works? Great. You can use the script in simple, classic way:

>php datex.php command [--parameter] [--switch]

Commands:

tables

>php datex.php tables

Writes list of accessible tables and views in database.

columns

>php datex.php columns --table table_name
>php datex.php columns -t=table_name

Writes list of columns of database table.

entity

>php datex.php entity --table table_name [--file path/to/EntityFile.php] [--overwrite] [--screen]
>php datex.php entity -t=table_name [-f="path/to/EntityFile.php"] [-o] [-s]

Creates PHP entity file based on colums of database table.

The file is placed in default directory declared in config section, or specified if file parameter of script.

If the target file already exists, script halts unless the ---overwite (-o) switch is used.

If the --screen (-s) switch is used, source code of PHP file is shown on screen and no file is written.

form

>php datex.php form --table table_name [--file path/to/EntityFile.php] [--overwrite] [--screen]
>php datex.php form -t=table_name [-f="path/to/EntityFile.php"] [-o] [-s]

Works same way as entity command, except that creates nette form file based on colums of database table.

model

>php datex.php model --table table_name [--file path/to/EntityFile.php] [--overwrite] [--screen]
>php datex.php model -t=table_name [-f="path/to/EntityFile.php"] [-o] [-s]

Works same way as entity and form command, except that creates PHP model file based on colums of database table.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-03-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固