定制 clabonte/codeprimer 二次开发

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

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

clabonte/codeprimer

Composer 安装命令:

composer require clabonte/codeprimer

包简介

CodePrimer, customizable production-grade code generator for architects and team leads

README 文档

README

build-shield coverage-shield Issues MIT License

CodePrimer’s primary objective is to allow software architects and senior developers to define the data model and related processing from a business point of view so that it can be easily understood and manipulated by entrepreneurs, business managers and business analysts before starting the software development process.

As such, it is meant to prime the software development process using simple, easy to use and effective representations that can be objectively interpreted by business and techies willing to cooperate to create digital businesses.

CodePrimer interprets this data model to generate a set of artifacts (e.g. source code) that are combined to build a production-grade software solution following the architect's vision to guide the development team to use his best practices.

The project offers an opinionated architecture, called Business Bundle to get started. The resulting solution is meant to be highly scalable, yet requiring very low maintenance by leveraging the best DevOps practices with a minimal technical team.

It liberally borrows and integrates concepts and best practices that have been made available over the years by several movements in the software development space, such as UML, Domain-Driven Design (DDD), agile, micro services and DevOps.

The resulting architecture and implementation is not meant to please everyone but the underlying goal is to produce top quality software that is meeting the business objectives for what it is being built and be easily understood, maintained and evolved by a software development team at a fraction of the time usually required to achieve production-grade software..

Thanks to the high flexibility of its artifact generation engine, the project can be easily tailored to suit any programming language or any architecture/framework chosen by the architect.

Documentation

In order to fully understand and leverage the capabilities offered by CodePrimer, you should refer to the following documents:

Getting Started

CodePrimer can be added as a library to an existing PHP project or used standalone to either generate artifacts or prime a new project.

Prerequisites

No matter how you want to use it, the installation instructions assume you already have the following:

Installation

Generating artifacts in an existing project

If you already have an existing PHP project, and you want to use CodePrimer to generate artifacts (e.g. source code) in it, you can simply add CodePrimer via composer:

composer require clabonte/codeprimer

Then, you will need to generate the configuration files for your project by running the init command and answering the various questions asked:

vendor/bin/codeprimer init

This will generate a set of files under the codeprimer directory that will be used by the prime command to generate the various artifacts you need:

vendor/bin/codeprimer prime

Using CodePrimer in standalone mode

If you don't have an existing project, or you are simply curious to see how it works, you can still clone the repository and installing its dependencies:

  1. Clone the repo
  2. Run composer install
git clone https://github.com/clabonte/codeprimer.git
cd codeprimer
composer install

Once you have cloned and installed the project, you can generate a set of Artifacts based on the Channel sample application by running the following command:

composer sample-app

Take a look at the sample/output folder to see the Artifacts generated by CodePrimer.

Usage

In order to understand what CodePrimer can be used for, it is best to look at a sample application.

You can also consult the list of Artifacts currently available and planned for CodePrimer.

Command Line

CodePrimer offers a simple CLI to either initializes a new CodePrimer-compatible project via the init command:

[vendor/]bin/codeprimer init

This command will create, at a minimum, the following files in the selected destination:

codeprimer/codeprimer.yaml
codeprimer/bundle.php
codeprimer/DatasetFactory.php
codeprimer/BusinessModelFactory.php
codeprimer/BusinessProcessFactory.php

Once you have initialized your project, you can prime artifacts via the prime command:

[vendor/]bin/codeprimer prime [-c <configuration_file>] [-d <destination>]

Configuration

The prime command currently uses the following files (generated by the init command) to configure its execution:

codeprimer/codeprimer.yaml

This file defines the list of Artifacts to generate for your project. Unless you want to change the list of artifacts to generate for your project, you do not need to modify this file.

codeprimer/bundle.php

This file coordinates the creation of your Business Bundle through the invocation of your factories (see below). As such, you should not modify this file.

codeprimer/DatasetFactory.php

This factory defines the list of Dataset instances that are part of your application.

You need to modify this file to design your business/application model as follow:

  • Create a set of public methods starting with the create name prefix with no parameters (e.g. createUserRole())
  • Each create method must return a Dataset instance describing a dataset used in your application.
  • The bundle.php file (see above) will automatically invoke all the create methods to add all Dataset instances to your application business bundle.

codeprimer/BusinessModelFactory.php

This factory defines the list of BusinessModel instances that are part of your application.

You need to modify this file to design your business/application model as follow:

  • Create a set of public methods starting with the create name prefix with no parameters (e.g. createUser())
  • Each create method must return a BusinessModel instance describing a business model used in your application. Your business model may reference datasets and/or other business models defined in their respective factories.
  • The bundle.php file (see above) will automatically invoke all the create methods to add all BusinessModel instances to your application business bundle.

codeprimer/BusinessProcessFactory.php

This factory defines the list of BusinessProcess instances that are part of your application.

You need to modify this file to design your business/application model as follow:

  • Create a set of public methods starting with the create name prefix with no parameters (e.g. createRegister())
  • Each create method must return a BusinessProcess instance describing a business process used in your application. Your business process must reference datasets and/or business models defined in their respective factories.
  • The bundle.php file (see above) will automatically invoke all the create methods to add all BusinessProcess instances to your application business bundle.

Roadmap

The high level roadmap and progress is available here

To have a more detailed view on upcoming changes, please look at the Product Roadmap or open issues for a list of proposed features and known issues.

Contributing

See CONTRIBUTING

Contact

Christian Labonte LinkedIn

Project Link: https://github.com/clabonte/codeprimer

License

This project uses the following license: MIT

clabonte/codeprimer 适用场景与选型建议

clabonte/codeprimer 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 08 月 28 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 clabonte/codeprimer 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 clabonte/codeprimer 我们能提供哪些服务?
定制开发 / 二次开发

基于 clabonte/codeprimer 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-08-28