Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mtvbrianking committed Jan 30, 2021
0 parents commit 5c6c78f
Show file tree
Hide file tree
Showing 20 changed files with 638 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -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
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{json,yml,yaml}]
indent_style = space
indent_size = 2
16 changes: 16 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Path-based git attributes
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html

# Uncomment the lines below for your package;
# These are basically files you don't want in a release.

# /.editorconfig export-ignore
# /.gitattributes export-ignore
# /.gitignore export-ignore
# /.php_cs export-ignore
# /.sami.dist export-ignore
# /.scrutinizer.yml export-ignore
# /.styleci.yml export-ignore
# /.travis.yml export-ignore
# /phpunit.xml.dist export-ignore
# /tests export-ignore
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.idea
.php_cs.cache
.phpunit.result.cache
composer.lock
coverage
coverage.clover
docs
vendor
84 changes: 84 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?php

// https://mlocati.github.io/php-cs-fixer-configurator/

$rules = [
'@PSR2' => true,

// Arrays
'array_syntax' => [
'syntax' => 'short',
],
'trim_array_spaces' => true,
'no_whitespace_before_comma_in_array' => true,
'whitespace_after_comma_in_array' => true,
'no_trailing_comma_in_singleline_array' => true,
'trailing_comma_in_multiline_array' => true,
'not_operator_with_successor_space' => true,

// General
'indentation_type' => true,
'single_quote' => true,
'no_unused_imports' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'no_extra_blank_lines' => true,
'no_whitespace_in_blank_line' => true,
'linebreak_after_opening_tag' => true,
'no_blank_lines_after_class_opening' => true,
'no_blank_lines_after_phpdoc' => true,
'cast_spaces' => true,
'concat_space' => [
'spacing' => 'none',
],
'blank_line_before_statement' => true,
'method_chaining_indentation' => true,
'ordered_imports' => [
'sort_algorithm' => 'alpha',
],
'single_line_comment_style' => [
'comment_types' => [
'hash',
],
],
'return_type_declaration' => [
'space_before' => 'none',
],

// Docs
'phpdoc_types' => true,
'phpdoc_indent' => true,
'phpdoc_to_comment' => true,
'phpdoc_trim' => true,
'phpdoc_align' => true,
'phpdoc_summary' => true,
'phpdoc_separation' => true,
'phpdoc_scalar' => true,
'phpdoc_order' => true,
'phpdoc_inline_tag' => true,
'phpdoc_return_self_reference' => true,
'phpdoc_var_without_name' => true,
'phpdoc_var_annotation_correct_order' => true,
'phpdoc_trim_consecutive_blank_line_separation' => true,
'phpdoc_add_missing_param_annotation' => [
'only_untyped' => false,
],
];

$excludes = [
'coverage',
'docs',
'vendor',
];

return PhpCsFixer\Config::create()
->setRules($rules)
->setFinder(
PhpCsFixer\Finder::create()
->exclude($excludes)
->in(__DIR__.'/config')
->in(__DIR__.'/src')
->in(__DIR__.'/tests')
->ignoreDotFiles(true)
->ignoreVCS(true)
);
35 changes: 35 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Code style
# https://scrutinizer-ci.com/docs/reviews/configure_automated_checks
checks:
php: true

filter:
excluded_paths:
- "docs/"
- "tests/"

# Tessts
# https://scrutinizer-ci.com/docs/configuration/build_reference

# build:
# environment:
# php:
# version: '7.2'
# requires:
# - branch: master
# nodes:
# analysis:
# tests:
# override:
# - php-scrutinizer-run

# Analysis
# https://scrutinizer-ci.com/docs/tools/external-code-coverage/

tools:
external_code_coverage: true

# Code Style
# https://scrutinizer-ci.com/docs/configuration/coding_style

coding_style:
18 changes: 18 additions & 0 deletions .styleci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
preset: laravel

disabled:
- single_class_element_per_statement

# https://docs.styleci.io/standalone-php#risky
risky: false

finder:
exclude:
- "config"
- "coverage"
- "database"
- "docs"
- "tests"
- "vendor"
name:
- "*.php"
57 changes: 57 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
language: php

cache:
directories:
- $HOME/.composer/cache/files

# https://docs.travis-ci.com/user/build-stages

jobs:

include:

- stage: test

php: 7.2

install:
- wget https://scrutinizer-ci.com/ocular.phar

before_script:
- travis_retry composer self-update
- travis_retry composer update --prefer-dist --no-ansi --no-interaction --no-progress --no-scripts

script:
- vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover

after_script:
- php ocular.phar code-coverage:upload --format=php-clover coverage.clover

- stage: deploy

name: "Documentation"

if: branch = master

php: 7.2

before_script:
- git clone https://github.com/mtvbrianking/laravel-package-boilerplate.git

script:
- vendor/bin/doctum.php update doctum.php

# https://docs.travis-ci.com/user/deployment/pages/
deploy:
provider: pages
skip-cleanup: true
github-token: $GITHUB_TOKEN
local_dir: docs
on:
branch: master

# https://docs.travis-ci.com/user/notifications
notifications:
email:
on_success: never
on_failure: always
66 changes: 66 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"name": "bmatovu/laravel-package-boilerplate",
"description": "Laravel package boilerplate.",
"homepage": "https://github.com/mtvbrianking/laravel-package-boilerplate",
"type": "project",
"license": "MIT",
"keywords": [
"laravel",
"lumen",
"package",
"development",
"starter",
"boilerplate"
],
"authors": [
{
"name": "Brian Matovu",
"email": "[email protected]",
"homepage": "http://bmatovu.com",
"role": "Developer"
}
],
"require": {
"php": "^7.2.5|^8.0",
"illuminate/support": "^6.0|^7.0|^8.0"
},
"require-dev": {
"code-lts/doctum": "^5.3",
"friendsofphp/php-cs-fixer": "^2.18",
"illuminate/container": "^6.0|^7.0|^8.0",
"orchestra/testbench": "^4.0|^5.0|^6.0",
"phpunit/phpunit": "^8.0|^9.0"
},
"autoload": {
"psr-4": {
"Bmatovu\\HelloWorld\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Bmatovu\\HelloWorld\\Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"cs-fix": "php-cs-fixer fix",
"cs-lint": "php-cs-fixer fix --dry-run",
"doc": "doctum.php update doctum.php",
"test": "phpunit",
"test-coverage": "phpunit --coverage-html coverage"
},
"config": {
"sort-packages": true
},
"extra": {
"laravel": {
"providers": [
"Bmatovu\\HelloWorld\\HelloWorldServiceProvider"
],
"aliases": {
"HelloWorld": "Bmatovu\\HelloWorld\\HelloWorldFacade"
}
}
}
}
5 changes: 5 additions & 0 deletions config/hello-world.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

return [
// ...
];
38 changes: 38 additions & 0 deletions doctum.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

require __DIR__.'/vendor/autoload.php';

use Doctum\Doctum;
use Doctum\RemoteRepository\GitHubRemoteRepository;
use Doctum\Version\GitVersionCollection;
use Symfony\Component\Finder\Finder;

$dir = __DIR__.'/src';

$iterator = Finder::create()
->files()
->name('*.php')
->exclude('tests')
->exclude('vendor')
->in($dir);

$versions = GitVersionCollection::create($dir)
->add('master', 'Master branch');

$repo = new GitHubRemoteRepository(
'mtvbrianking/laravel-package-boilerplate',
dirname($dir),
'https://github.com/'
);

$options = [
'theme' => 'default',
'versions' => $versions,
'title' => 'Laravel Package Boilerplate',
'build_dir' => __DIR__.'/docs',
'cache_dir' => __DIR__.'/docs/cache',
'remote_repository' => $repo,
'default_opened_level' => 3,
];

return new Doctum($iterator, $options);
21 changes: 21 additions & 0 deletions license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) <Brian Matovu>

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.
Loading

0 comments on commit 5c6c78f

Please sign in to comment.