PHP Classes

How Can PHP Create a Project with Composer to Push to GitHub Using the Package PHP Project Template: Generate files for PHP projects from templates

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-11-06 (Yesterday) RSS 2.0 feedNot enough user ratingsTotal: 1 This week: 1All time: 11,479 This week: 64Up
Version License PHP version Categories
php-project-template 1.0.0MIT/X Consortium ...8.2.0Project Management, Code Generation, P...
Description 

Author

This package can generate files for PHP projects from templates.

It can generate common files that are necessary in PHP code repositories or packages.

The package uses PHP composer create-project command to create a project from a template in GitHub.

Simple template repository for PHP libraries/projects.

Picture of Eric Sizemore
  Performance   Level  
Name: Eric Sizemore <contact>
Classes: 16 packages by
Country: United States United States
Innovation award
Innovation award
Nominee: 4x

Winner: 2x

Documentation

PHP Project Template

Build Status Code Coverage Scrutinizer Code Quality Continuous Integration Type Coverage Psalm Level Mutation testing badge Latest Stable Version Downloads per Month License

ericsizemore/php-project-template started as a template to be used for my own future repos/libraries, with the goal of eventually bringing my current repos to parity with this setup.

This package can be used to create a basic PHP library package/repository, complete with a directory structure and starting files (i.e. README, LICENSE, issue templates, PHPUnit configuration, etc.) commonly found in PHP libraries.

> [!WARNING] > > This project is not finished yet, work in progress.

Installation

You can install the package via composer:

$ composer create-project ericsizemore/php-project-template YOUR-PROJECT-NAME

You can also create a repository from this template on GitHub.

Workflow Setup

The continuous-integration.yml workflow expects the project to exist on Scrutinizer so that it can upload coverage reports. It also makes use of CodeCov, so it will require a new repository/action secret named CODECOV_TOKEN.

Renovate is used to handle automated updating of composer dependencies. A merge-me.yml workflow is provided to automatically merge PR's created by Renovate. This requires Allow auto-merge to be enabled in repository settings, and a new repository/action secret named MERGE_ME.

          # Create a token with repository permissions:
          # https://github.com/settings/tokens/new?scopes=repo&description=Merge+Me!+GitHub+Actions+Workflow
          #
          # Set MERGE_TOKEN as an environment variable on your repository:
          # https://github.com/yourname/repo-name/settings/secrets/actions/new

The mutation-test portion of the continuous-integration.yml workflow sends mutation coverage (handled with Infection) information to Stryker and requires a new repository/action secret named STRYKER_DASHBOARD_API_KEY.

Usage

// usage information here

About

Requirements

  • PHP >= 8.2

Credits

Contributing

See CONTRIBUTING.

Bugs and feature requests are tracked on GitHub.

Contributor Covenant Code of Conduct

See CODE_OF_CONDUCT.md

Backward Compatibility Promise

See backward-compatibility.md for more information on Backwards Compatibility.

Changelog

See the CHANGELOG for more information on what has changed recently.

License

See the LICENSE for more information on the license that applies to this project.

Security

See SECURITY for more information on the security disclosure process.


  Files folder image Files (26)  
File Role Description
Files folder image.github (2 files, 2 directories)
Files folder imagesrc (1 file)
Files folder imagetests (1 file)
Accessible without login Plain text file .php-cs-fixer.dist.php Example Example script
Accessible without login Plain text file .scrutinizer.yml Data Auxiliary data
Accessible without login Plain text file backward-compatibility.md Data Auxiliary data
Accessible without login Plain text file CHANGELOG.md Data Auxiliary data
Accessible without login Plain text file CODE_OF_CONDUCT.md Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file CONTRIBUTING.md Data Auxiliary data
Accessible without login Plain text file infection.json5 Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file phpstan.neon Data Auxiliary data
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file psalm.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file renovate.json Data Auxiliary data
Accessible without login Plain text file SECURITY.md Data Auxiliary data

  Files folder image Files (26)  /  .github  
File Role Description
Files folder imageISSUE_TEMPLATE (3 files)
Files folder imageworkflows (3 files)
  Accessible without login Plain text file FUNDING.yml Data Auxiliary data
  Accessible without login Plain text file pull_request_template.md Data Auxiliary data

  Files folder image Files (26)  /  .github  /  ISSUE_TEMPLATE  
File Role Description
  Accessible without login Plain text file 1-bug_report.yml Data Auxiliary data
  Accessible without login Plain text file 2-feature_request.yml Data Auxiliary data
  Accessible without login Plain text file config.yml Data Auxiliary data

  Files folder image Files (26)  /  .github  /  workflows  
File Role Description
  Accessible without login Plain text file continuous-integration.yml Data Auxiliary data
  Accessible without login Plain text file merge-me.yml Data Auxiliary data
  Accessible without login Plain text file release.yml Data Auxiliary data

  Files folder image Files (26)  /  src  
File Role Description
  Plain text file PhpProjectTemplate.php Class Class source

  Files folder image Files (26)  /  tests  
File Role Description
  Accessible without login Plain text file PhpProjectTemplateTest.php Test PHPUnit test class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:1
This week:1
All time:11,479
This week:64Up