Skip to content

Reduce common and repetitive steps during a Composer package creation

License

Notifications You must be signed in to change notification settings

tandiljuan/composer-package-boilerplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Composer Package Boilerplate

This project is meant to reduce common and repetitive steps during a Composer package creation.

Contributions must follow Symfony Coding Standards.

It's encouraged to read the following documentation:

Usage

  1. Clone this project

  2. Replace template text

find . \
    -not \( -path ./.git -prune \) \
    -not \( -path ./.composer -prune \) \
    -not \( -path ./.psysh -prune \) \
    -not \( -path ./vendor -prune \) \
    -type f \
    -exec \
        sed -i \
            -e 's/vendor-name/custom-vendor-name/g' \
            -e 's/VendorName/CustomVendorName/g' \
            -e 's/package-name/custom-package-name/g' \
            -e 's/PackageName/CustomPackageName/g' \
            -e 's/PROJECT_DESCRIPTION/Custom Project Description/g' \
            -e 's/AUTHOR_NAME/Custom Author Name/g' \
            -e 's/AUTHOR_EMAIL/author@email.com/g' \
            '{}' \
    \;

Also update this README file.

  1. Install dependencies
./run composer install
  1. Start coding!

Development

The run bash script is a wrapper of a php docker container. It will bootstrap the container and run a given command inside of it. The container should have all needed tools for development. Please, let know the project maintainer if something is missing.

To add new packages in the composer.json file, use composer require

./run composer require [--dev] [vendor/package:version]

To install packages defined in the composer.json file, use composer install

./run composer install

To check PHP code against coding standards, use php-cs-fixer

# Check if a file needs to be fixed
./run php-cs-fixer fix --dry-run --diff path/to/file.php
# Fix a file
./run php-cs-fixer fix path/to/file.php

To run PHP REPL interactive shell, use php or psysh

# Using PHP
./run php -a
# Using psysh
./run psysh

Testing

Bootstrap Codeception test environment. This must be done only once.

$ # Bootstrap codeception without the standard suites
$ ./run codecept bootstrap --empty --namespace 'VendorName\PackageName\Tests'

Create a codeception test suit. This must be done only once per suit.

$ # Create `unit` suit (for unit testing)
$ ./run codecept generate:suite unit

Create a Cest class under a given suit. Can create as many Cest classes as needed.

$ # Create a new cest `Dummy` under the `unit` suit
$ ./run codecept generate:cest unit Dummy

After writing the tests, can execute them using the run command

$ ./run codecept run

About

Reduce common and repetitive steps during a Composer package creation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published