定制 samshal/scripd 二次开发

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

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

samshal/scripd

Composer 安装命令:

composer require samshal/scripd

包简介

Easily transfer database structures as json documents, or via rest apis

README 文档

README

A robust SQL Generator. Parses database structures defined in json based on a custom jsyn file format and generates corresponding sql queries.

Class Features

  • A json like file format to define database structure
  • Support for multiple sql vendors / dialects
  • Compatible with PHP 5.0+
  • Support for UTF-8 content and 8bit, base64, binary, and quoted-printable encodings
  • Much More!

Why you might need it

This project was birthed as a result of the need to give users an opportunity to create their own custom database structure in a PHP Application. I wanted users to be able to modify database structures while there is support for multiple db vendors such as mysql, sqlite and sql server.

This library offers the ability to create database structures in a json-like format and generate sql compatible with several database vendors.

It is also very easy to use and integrate into your php based projects

License

This software is distributed under the MIT license. Please read LICENSE for information on the software availability and distribution.

Installation & loading

Scripd is available via Composer/Packagist, so just add this line to your composer.json file:

"samshal/scripd": "~1.0"

or

composer require samshal/scripd

A Simple Example

JSON DB Structure (structure.json)

{
	":database":{
		":crud-action":"create",
		"name":"dbname",

		":table":[
			{
				":crud-action":"create",
				"name":"students",
				"columns":[
					{
						"name":"id",
						"data-type":"int",
						"primary-key":true
					},
					{
						"name":"first_name",
						"data-type":"varchar(20)",
						"default":"'samuel'"
					},
					{
						"name":"last_name",
						"data-type":"varchar(20)"
					},
					{
						"name":"class",
						"data-type":"varchar(10)"
					}
				]
			}
		]
	}
}

PHP (index.php)

<?php
    require 'vendor/autoload.php';

    $jsonDBStructure = new Samshal\Scripd\JsonDbStructure('./structure.json', 'mysql');

    $jsonDBStructure->parseStructure();

    $sql = $jsonDBStructure->getGeneratedSql();
    
    echo $sql;

统计信息

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

GitHub 信息

  • Stars: 11
  • Watchers: 3
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-04-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固