Skip to content

Repository templates

Robbie Averill edited this page Nov 27, 2018 · 11 revisions

This page contains a set of pre-defined templates for use when setting up a new SilverLeague repository.

Note: Templates in this page may be updated at any time!

LICENSE.md

# MIT License

Copyright (c) [year] SilverLeague

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

CONTRIBUTING.md

# Contributing

We'd love you to contribute! We do have a couple of processes to follow though depending on the "phase" of the module you're using:

**Draft phase:** Please submit pull requests to the appropriate module "specification" file and indicate your suggested changes. Feel free to review other requests too. Requests will be merged by a SilverLeague community member once approved.

**Development and active support phase:** Ideas, proposals and contributions are readily accepted in the form of issues or pull requests on the appropriate SilverLeague repository. Pull requests can be merged by one of the module's maintainers (see the module's readme for who they are).

.travis.yml

language: php

env:
  global:
    - COMPOSER_ROOT_VERSION="1.1.x-dev"

matrix:
  include:
    - php: 5.6
      env: DB=MYSQL RECIPE_VERSION=1.0.x-dev PHPCS_TEST=1 PHPUNIT_TEST=1
    - php: 7.0
      env: DB=MYSQL RECIPE_VERSION=1.1.x-dev PHPUNIT_COVERAGE_TEST=1
    - php: 7.1
      env: DB=PGSQL RECIPE_VERSION=4.2.x-dev PHPUNIT_TEST=1
    - php: 7.2
      env: DB=MYSQL RECIPE_VERSION=4.3.x-dev PHPUNIT_TEST=1
    - php: 7.3
      env: DB=MYSQL RECIPE_VERSION=1.x-dev PHPUNIT_TEST=1

before_script:
  - phpenv rehash
  - phpenv config-rm xdebug.ini || true

  - composer validate
  - composer require --prefer-dist --no-update silverstripe/recipe-core:$RECIPE_VERSION
  - if [[ $DB == PGSQL ]]; then composer require --prefer-dist --no-update silverstripe/postgresql:2.1.x-dev; fi
  - composer update

script:
  - if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit; fi
  - if [[ $PHPUNIT_COVERAGE_TEST ]]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml; fi
  - if [[ $PHPCS_TEST ]]; then vendor/bin/phpcs src/ tests/ *.php; fi

after_success:
  - if [[ $PHPUNIT_COVERAGE_TEST ]]; then bash <(curl -s https://codecov.io/bash) -f coverage.xml; fi

.scrutinizer.yml

inherit: true

build:
  nodes:
    analysis:
      tests:
        override: [php-scrutinizer-run]

checks:
  php:
    code_rating: true
    duplication: true

filter:
  paths: [src/*, tests/*]

README.md

# silverleague/silverstripe-[modulename]

*Add build, quality, coverage and versioning badges here.*

A description of the module.

*Add screenshot of module in action here.*

## Requirements

* PHP 5.6+
* SilverStripe ^4.0
* Composer

## Installation

Install with composer.

## Configuration

How to configure the module.

## Support

If you encounter a problem with our module then please let us know by raising an issue on our [issue tracker](https://github.com/silverleague/silverstripe-[modulename]/issues).

Ensure you tell us which version of this module you are using, as well as which versions of PHP and SilverStripe framework you are using. If you aren't sure, you can find out by running the following commands from your command line: `php -v`, `composer show silverleague/[modulename]` and `composer show silverstripe/framework`.

| Role          | Name                                          |
| ------------- | --------------------------------------------- |
| Maintainer    | [github-user](https://github.com/github-user) |
| Co-maintainer | [github-user](https://github.com/github-user) |
| Advocate      | [github-user](https://github.com/github-user) |

## Contributing

Please see [the contributing guide](CONTRIBUTING.md) for more information.

## License

This module is licensed under the [MIT license](LICENSE.md).

phpunit.xml.dist

If using, should be based on that from the silverstripe/installer repository. Otherwise rely on its default phpunit.xml.dist file to provide test bootstrapping for TravisCI etc.

phpcs.xml.dist

<?xml version="1.0"?>
<ruleset>
    <file>./src</file>
    <file>./tests</file>
    <rule ref="PSR2" />
</ruleset>