g1a/starter 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

g1a/starter

Composer 安装命令:

composer require g1a/starter

包简介

Template project for PHP libraries.

README 文档

README

A starter PHP project with many services and features pre-configured.

License

Features

The things this project provides or does includes:

Creates GitHub project README with customization instructions
Optimized composer.json GitHub contributing and issue templates
Commandline tool with phar builder Data-driven unit test examples
Links to Coveralls code coverage setup Test matrix for PHP 8.0 - 8.1
Links to Packagist setup PSR-2 checks and PHP linting
Phar self:update command Configuration files

For more details, see the section Explanation of Features, below.

Usage

To get started, export your GitHub personal access token and then create a new project.

$ export GITHUB_TOKEN='...'
$ composer create-project g1a/starter my-new-project

The new project will be owned by the currently-authenticated user. If you would like to create a new project in an organization instead, then set the GITHUB_ORG environment variable.

$ export GITHUB_ORG='my-github-username-or-org'

The new project will work only with php 8.0 and later. If you need to use an earlier version of php (as far back as php 7.1), then instead run:

$ composer create-project g1a/starter my-new-project:^2

Once the new project is created, automated scripts will customize it and set up a number of serivces. See the section Description of Features below for more information. Once the scripts have finished running, you may customize your README file and start coding!

Access Token Generation

Generating and exporting a personal access token for the services below is recommended, as doing this will allow the post-create-project scripts to configure and enable these services automatically.

Export Token Generation URL
exoirt GITHUB_TOKEN='...' Generate GitHub token

Manual Service Configuration

If the personal access token for these services is not set up, then the service may be manually configured later. In addition, this project is also configured for use with Packagist, this service only needs to be manually authorized through their web interface to enable them for projects created with this template.

Follow the links in the table below to configure the services you would like to use.

Feature Manual Setup URL
Collaborative repository Create GitHub project
Package manager Register with Packagist

Explanation of Features

GitHub project

After the composer create-project command runs to create your new project from the templates provided, a GitHub project will automatically be created, and your code will automatically be pushed up.

In order for this to work, you must define a GITHUB_TOKEN environment variable as described in the usage section.

README template

Your new project will be set up with the outline for a project README, complete with status badges, ready to be customized. Follow the instructions provided in your new project to complete the customization steps.

GitHub Actions Testing

GitHub actions will automatically run your unit tests every time a commit is pushed up to GitHub.

Packagist code distribution

Packagist is the main repository for Composer projects. The customization instructions for your project includes a link you may follow to register your project in this repository.

Data-driven unit test examples

Your new project comes with a trivial Example class with tests that demonstrate the phpunit @dataProvider feature.

Test matrix for PHP 8.0 - 8.1

The included test suite demonstrates testing on multiple platforms and PHP versions.

PSR-2 checks and PHP linting

In addition to providing unit tests with phpunit, your new project will also automatically contain style checks for PSR-2 coding convnetions, and will lint your code for syntax errors and other problems.

These features may be accessed via composer cs and composer lint commands, respectively. A .editorconfig file is provided pre-configured to maintain PSR-2 coventions in editors that support this feature.

GitHub contributing and issue templates

GitHub has a feature that allows projects to define pull request and issue templates which will be presented to users when a new issue or pull request is opened. Also, a contributing document can be provided to explain project conventions to new users.

Starter versions for all of these files are automatically added to your new project, and may be customized as needed. By default, the CONTRIBUTING.md file is added to the project root for better visiblity, but you may move it to the .github directory if you prefer.

Commandline tool

Your project will be set up to build a commandline tool, and also includes commands to package it as a phar using the humbug/box project. If your project is a library, you might still wish to include a commandline tool to provide ad-hoc usage to your library functions, either for testing purposes, or perhaps to directly edit any data stores managed by your library. The commandline tool dependencies are declared in the require-dev section, so they will not be pulled in when your project is included as the dependency of some other project.

If you do not want the commandline tool, simply delete the directories src/Cli and tests/ExampleCommandsTest.php, and also remove the phar:* commands in your composer.json file, and the files example and box.json.dist.

Optimized composer.json

The composer.json file included in the project pre-configures a few settings for convenience:

  • optimize-autoloader: Creates larger autoload files that find classes more quickly
  • sort-packages: Keeps the list of packages in alphabetic order
  • platform:php: Ensures that Composer will only select packages that are compatible with the stated minimum PHP version.

Optimized Composer dist releases

Your project's .gitattributes file comes pre-configured to exclude unnecessary files in Composer dist releases.

Configuration files

Your project will automatically read in a configuration file in yaml format that you may use for providing command option default values and storing other user-overridable settings. See consolidation/config for more information.

Contributing

Please read CONTRIBUTING.md for details on the process for submitting pull requests to us.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

g1a/starter 适用场景与选型建议

g1a/starter 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 163 次下载、GitHub Stars 达 46, 最近一次更新时间为 2018 年 05 月 26 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 46
  • Watchers: 4
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-05-26