From b01bf0ed221bad021270ca45de0ec09c6a1e0341 Mon Sep 17 00:00:00 2001 From: Sven Luijten <11269635+svenluijten@users.noreply.github.com> Date: Mon, 10 Jul 2023 14:03:42 +0200 Subject: [PATCH] Initial commit --- .editorconfig | 19 +++++++ .gitattributes | 9 ++++ .github/dependabot.yml | 6 +++ .github/workflows/run-tests.yml | 30 +++++++++++ .gitignore | 3 ++ .styleci.yml | 10 ++++ CONTRIBUTING.md | 93 +++++++++++++++++++++++++++++++++ LICENSE.md | 21 ++++++++ README.md | 83 +++++++++++++++++++++++++++++ composer.json | 42 +++++++++++++++ phpunit.xml.dist | 18 +++++++ src/Package.php | 8 +++ src/ServiceProvider.php | 28 ++++++++++ tests/TestCase.php | 11 ++++ 14 files changed, 381 insertions(+) create mode 100644 .editorconfig create mode 100644 .gitattributes create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/run-tests.yml create mode 100644 .gitignore create mode 100644 .styleci.yml create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE.md create mode 100644 README.md create mode 100644 composer.json create mode 100644 phpunit.xml.dist create mode 100644 src/Package.php create mode 100644 src/ServiceProvider.php create mode 100644 tests/TestCase.php diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..081ec3b --- /dev/null +++ b/.editorconfig @@ -0,0 +1,19 @@ +; This file is for unifying the coding style for different editors and IDEs. +; More information at http://editorconfig.org + +root = true + +[*] +charset = utf-8 +indent_size = 4 +indent_style = space +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +trim_trailing_whitespace = false + +[composer.json] +indent_size = 4 +indent_style = space diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..eb12dd6 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,9 @@ +* text=auto + +/tests export-ignore +/.editorconfig export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore +/.styleci.yml export-ignore +/CONTRIBUTING.md export-ignore +/phpunit.xml.dist export-ignore diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..6bd86e3 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: weekly diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml new file mode 100644 index 0000000..b9dd4a3 --- /dev/null +++ b/.github/workflows/run-tests.yml @@ -0,0 +1,30 @@ +name: Tests +on: [push, pull_request] + +jobs: + test: + name: PHP ${{ matrix.php }} on ${{ matrix.os }} (${{ matrix.dependency-version }}) + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + php: [8.0] + dependency-version: [highest, lowest] + steps: + - uses: actions/checkout@v3.5.3 + + - name: Configure PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: mbstring, fileinfo + coverage: none + + - name: Install dependencies + uses: ramsey/composer-install@v2 + with: + dependency-versions: ${{ matrix.dependency-version }} + composer-options: "--prefer-dist" + + - name: Execute tests + run: vendor/bin/phpunit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2885bcd --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/composer.phar +/composer.lock +/vendor diff --git a/.styleci.yml b/.styleci.yml new file mode 100644 index 0000000..c49abed --- /dev/null +++ b/.styleci.yml @@ -0,0 +1,10 @@ +preset: laravel + +risky: false + +enabled: + - phpdoc_order + - phpdoc_separation + +disabled: + - not_operator_with_successor_space diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..4b82055 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,93 @@ +# How to contribute +Thank you for considering to contribute to this repository! This file will walk you through all the steps to ensure both +you and I have a good time submitting and reviewing your contribution. First off, some basic rules and reading material: + +- Submit your work in a new branch and make the PR to the master branch. +- [Write a short & descriptive commit message](http://chris.beams.io/posts/git-commit/). +- Rebase before committing the final change. +- Stick to [PSR-2](http://www.php-fig.org/psr/psr-2/). +- Add tests if necessary and ensure all the tests are green on the final commit. +- Make sure the CI tools used by the repository are all in order. If one fails, you should make it pass. + +## Contributing +Here are the steps to follow to contribute to this repository: + +- [Fork this repository on GitHub](#fork-this-repository). +- [Clone your fork to your local machine](#clone-your-fork). +- [Create a feature branch](#create-a-branch). +- [Add an 'upstream' remote](#add-a-remote). +- [Regularly pull & rebase from the upstream remote](#pull-and-rebase). +- [Work on feature branch](#working-on-branch). +- [Make tests pass](#make-tests-pass) +- [Submit a pull request to the master branch](#submitting-pull-request). + +### Fork this repository +Fork the repository right here on GitHub. To learn more about forking a repository, visit +[GitHub's help article](https://help.github.com/articles/fork-a-repo/). + +### Clone your fork +Clone your repository on your local machine to start work on your pull request. + +```bash +$ git clone git@github.com:/.git +# Or if you prefer HTTPS: +$ git clone https://github.com//.git + +$ cd +``` + +### Create a branch +Make your own feature branch in order not to clutter up master. + +```bash +# Think of a good name for your branch: +# fix/typo-in-readme +# feature/some-feature +# bug/some-bug-you-are-fixing +$ git checkout -b +``` + +### Add a remote +Add an 'upstream' remote to pull from and to stay up to date with the work being done in there. + +```bash +# List all current remotes +$ git remote -v +origin git@github.com//.git (fetch) +origin git@github.com//.git (push) + +# Add a new remote called 'upstream' +$ git remote add upstream git@github.com:svenluijten/.git +# Or if you prefer HTTPS: +$ git remote add upstream https://github.com/svenluijten/.git + +# The new remote should now be in the list +$ git remote -v +origin git@github.com//.git (fetch) +origin git@github.com//.git (push) +upstream git@github.com/svenluijten/.git (fetch) +upstream git@github.com/svenluijten/.git (push) +``` + +### Pull and rebase +Pull from upstream to stay up to date with what others might be doing in this repository. Any merge conflicts that arise +are your responsibility to resolve. + +```bash +$ git pull --rebase upstream master +``` + +### Working on branch +Do your magic and make your fix. I can't help you with this 😉. Once you're happy with the result and all tests pass, +go ahead and push to your feature branch. + +```bash +$ git push origin +``` + +### Make tests pass +You can run `composer check` to see if the tests & static analysis pass. Feel free to only run the static analyses at the +very end, this could take a while on bigger projects. To only run the tests, run `composer test`. + +### Submitting pull request +Now, let's head back over to this repository on GitHub and submit the pull request! diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..2951437 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +# The MIT License (MIT) + +Copyright (c) Sven Luijten + +> 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. diff --git a/README.md b/README.md new file mode 100644 index 0000000..3ff3126 --- /dev/null +++ b/README.md @@ -0,0 +1,83 @@ +![:package](:hero) + +# :package + +[![Latest Version on Packagist][ico-version]][link-packagist] +[![Total Downloads][ico-downloads]][link-downloads] +[![Software License][ico-license]](LICENSE.md) +[![Build Status][ico-build]][link-build] +[![StyleCI][ico-styleci]][link-styleci] + +Short description of the package. What does it do and why should people download +it? Brag a bit but don't exaggerate. Talk about what's to come and tease small +pieces of functionality. + +> :namespace +> :package +> :styleci +> :hero + +## Installation +You'll have to follow a couple of simple steps to install this package. + +### Downloading +Via [composer](http://getcomposer.org): + +```bash +$ composer require sven/:package +``` + +Or add the package to your dependencies in `composer.json` and run +`composer update` on the command line to download the package: + +```json +{ + "require": { + "sven/:package": "*" + } +} +``` + + +### Registering the service provider +> Is this a Laravel package? + +Next, add the `ServiceProvider` to your `providers` array in `config/app.php`: + +```php +'providers' => [ + ... + Sven\:namespace\ServiceProvider::class, +]; +``` + +If you would like to load this package in certain environments only, take a look +at [sven/env-providers](https://github.com/svenluijten/env-providers). + +## Usage +Some examples of the code. How should people use it, what options does this package +provide? Should people be wary of some functionality? + +```php +Maybe some code? +``` + +## Contributing +All contributions (pull requests, issues and feature requests) are +welcome. Make sure to read through the [CONTRIBUTING.md](CONTRIBUTING.md) first, +though. See the [contributors page](../../graphs/contributors) for all contributors. + +## License +`sven/:package` is licensed under the MIT License (MIT). Please see the +[license file](LICENSE.md) for more information. + +[ico-version]: https://img.shields.io/packagist/v/sven/:package.svg?style=flat-square +[ico-license]: https://img.shields.io/badge/license-MIT-green.svg?style=flat-square +[ico-downloads]: https://img.shields.io/packagist/dt/sven/:package.svg?style=flat-square +[ico-build]: https://img.shields.io/github/workflow/status/svenluijten/:package/Tests?style=flat-square +[ico-styleci]: https://styleci.io/repos/:styleci/shield + +[link-packagist]: https://packagist.org/packages/sven/:package +[link-downloads]: https://packagist.org/packages/sven/:package +[link-build]: https://github.com/svenluijten/:package/actions/workflows/run-tests.yml +[link-styleci]: https://styleci.io/repos/:styleci diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..06895ec --- /dev/null +++ b/composer.json @@ -0,0 +1,42 @@ +{ + "name": "sven/:package", + "description": "", + "keywords": [], + "license": "MIT", + "authors": [ + { + "name": "Sven Luijten", + "email": "contact@svenluijten.com", + "homepage": "https://svenluijten.com" + } + ], + "require": { + "php": "^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "autoload": { + "psr-4": { + "Sven\\:namespace\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Sven\\:namespace\\Tests\\": "tests/" + } + }, + "config": { + "sort-packages": true + }, + "extra": { + "laravel": { + "providers": [ + "Sven\\:namespace\\ServiceProvider" + ], + "aliases": { + ":namespace": "Sven\\:namespace\\Facades\\:namespace" + } + } + } +} diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..ec5a5a6 --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,18 @@ + + + + + ./tests/ + + + diff --git a/src/Package.php b/src/Package.php new file mode 100644 index 0000000..0c27732 --- /dev/null +++ b/src/Package.php @@ -0,0 +1,8 @@ +