Initial commit

master
Gertjan Krol 2022-08-20 18:00:15 +02:00
commit 11fa4abcd1
20 changed files with 443 additions and 0 deletions

6
.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
/.idea/
/vendor/
composer.lock
*cache*
*.log
*.tmp

88
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,88 @@
stages:
- prepare
- test
prepare:composer-install:
stage: prepare
tags:
- prepare
image: composer:2.4
script:
- echo "Start composer install"
- composer install --no-scripts --verbose --prefer-dist --no-progress --no-interaction --optimize-autoloader
artifacts:
expire_in: 1h
paths:
- composer.lock
- vendor/
interruptible: true
test:composer-security-check:
stage: test
tags:
- test
needs:
- job: prepare:composer-install
artifacts: true
image: composer:2.4
script:
- echo "Start package security check"
- composer security-checker
allow_failure: true
interruptible: true
test:php-codesniffer:
stage: test
tags:
- test
needs:
- job: prepare:composer-install
artifacts: true
image: composer:2.4
script:
- echo "Start PHP code sniffer"
- composer style
interruptible: true
# https://github.com/overtrue/phplint
test:php-lint:
stage: test
tags:
- test
needs:
- job: prepare:composer-install
artifacts: true
image: composer:2.4
script:
- composer lint
interruptible: true
except:
- /^v\d+\.\d+\.\d+$/
test:phpunit-tests:
stage: test
tags:
- test
needs:
- job: prepare:composer-install
artifacts: true
image: composer:2.4
script:
- echo "Start PHPUnit tests"
- composer test
interruptible: true
test:composer-require-checker:
stage: test
tags:
- test
needs:
- job: prepare:composer-install
artifacts: true
image: composer:2.4
script:
- echo "Downloading Composer require checker"
- curl -OL https://github.com/maglnet/ComposerRequireChecker/releases/download/4.0.0/composer-require-checker.phar
- echo "Start Composer require checker"
- php composer-require-checker.phar check composer.json
interruptible: true

8
.phplint.yml Normal file
View File

@ -0,0 +1,8 @@
path: ./
jobs: 10
cache: cache/phplint
extensions:
- php
exclude:
- vendor
warning: false

7
CHANGELOG.md Normal file
View File

@ -0,0 +1,7 @@
# Changelog
All notable changes to this package will be documented in this file
## Unreleased
## 1.0.0 - 202X-XX-XX
- Initial release [major]

53
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,53 @@
# Contributing
Contributions are **welcome** and will be fully **credited**.
Please read and understand the contribution guide before creating an issue or pull request.
## Etiquette
This project is open source, and as such, the maintainers give their free time to build and maintain the source code
held within. They make the code freely available in the hope that it will be of use to other developers. It would be
extremely unfair for them to suffer abuse or anger for their hard work.
Please be considerate towards maintainers when raising issues or presenting pull requests. Let's show the
world that developers are civilized and selfless people.
It's the duty of the maintainer to ensure that all submissions to the project are of sufficient
quality to benefit the project. Many developers have different skillsets, strengths, and weaknesses. Respect the maintainer's decision, and do not be upset or abusive if your submission is not used.
## Viability
When requesting or submitting new features, first consider whether it might be useful to others. Open
source projects are used by many developers, who may have entirely different needs to your own. Think about
whether or not your feature is likely to be used by other users of the project.
## Procedure
Before filing an issue:
- Attempt to replicate the problem, to ensure that it wasn't a coincidental incident.
- Check to make sure your feature suggestion isn't already present within the project.
- Check the pull requests tab to ensure that the bug doesn't have a fix in progress.
- Check the pull requests tab to ensure that the feature isn't already in progress.
Before submitting a pull request:
- Check the codebase to ensure that your feature doesn't already exist.
- Check the pull requests to ensure that another person hasn't already submitted the feature or fix.
## Requirements
- **Follow the [Crawl Coding Standard](https://git.gertjankrol.nl/crawl/coding-standard)** - Basically run `composer style` before committing/pushing.
- **Add tests!**
- **Document any change in behaviour** - Make sure the `CHANGELOG.md`, `README.md` and any other relevant documentation are kept up-to-date.
- **Consider our release cycle** - We try to follow [SemVer v2.0.0](https://semver.org/). Randomly breaking public APIs is not an option.
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](https://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting.
**Happy coding**!

21
LICENSE.md Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) Author
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.

45
README.md Normal file
View File

@ -0,0 +1,45 @@
# GKcld Laravel package skeleton
[![Latest Version on Packagist](https://img.shields.io/packagist/v/gkcld/skeleton.svg?style=flat-square)](https://packagist.org/packages/gkcld/skeleton)
[![Total Downloads](https://img.shields.io/packagist/dt/gkcld/skeleton.svg?style=flat-square)](https://packagist.org/packages/gkcld/skeleton)
This is where your description should go. Try and limit it to a paragraph or two, and maybe throw in a mention of what PSRs you support to avoid any confusion with users and contributors.
## Installation
You can install the package via composer:
```bash
composer require gkcld/skeleton
```
## Usage
```php
// Usage description here
```
### Testing
```bash
composer test
```
### Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
### Security
If you discover any security related issues, please email security@gkcld.net instead of using the issue tracker.
## Authors
- [Gertjan Krol](https://git.gertjankrol.nl/gertjan)
## License
The MIT License (MIT). Please see [LICENSE](LICENSE.md) for more information.

64
composer.json Normal file
View File

@ -0,0 +1,64 @@
{
"name": "gkcld/skeleton",
"description": "GKcld Laravel package skeleton",
"keywords": [
"gkcld",
"crm",
"skeleton"
],
"homepage": "https://git.gertjankrol.nl/gkcld/skeleton",
"license": "MIT",
"type": "library",
"authors": [
{
"name": "Gertjan Krol",
"email": "hello@gertjankrol.nl"
}
],
"require": {
"php": "^8.1",
"illuminate/support": "^8.0"
},
"require-dev": {
"orchestra/testbench": "^6.24",
"enlightn/security-checker": "^1.10",
"crawl/coding-standard": "^1.0",
"mockery/mockery": "^1.5",
"overtrue/phplint": "^4.3",
"phpunit/phpunit": "^9.5"
},
"autoload": {
"psr-4": {
"GKcld\\Skeleton\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"GKcld\\Skeleton\\Tests\\": "tests"
}
},
"scripts": {
"lint": "vendor/bin/phplint ./ --exclude=vendor",
"style": "vendor/bin/phpcs --standard=phpcs.xml",
"fix-style": "vendor/bin/phpcbf --standard=phpcs.xml",
"security-checker": "vendor/bin/security-checker security:check composer.lock",
"test": "vendor/bin/phpunit --configuration phpunit.xml --colors=never"
},
"config": {
"optimize-autoloader": true,
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"extra": {
"laravel": {
"providers": [
"GKcld\\Skeleton\\SkeletonServiceProvider"
],
"aliases": {
"Skeleton": "GKcld\\Skeleton\\SkeletonFacade"
}
}
}
}

10
config/config.php Normal file
View File

@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
/*
* `skeleton` configuration
*/
return [
];

View File

21
phpcs.xml Normal file
View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="CCS-P-1">
<description>Crawl Coding Standard for Packages</description>
<rule ref="vendor/crawl/coding-standard/src/rulesets/phpcs.xml"/>
<rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName">
<properties>
<property name="rootNamespaces" type="array">
<element key="src" value="GKcld\Skeleton"/>
<element key="tests" value="GKcld\Skeleton\Tests"/>
</property>
</properties>
</rule>
<file>config</file>
<file>database</file>
<file>resources</file>
<file>src</file>
<file>tests</file>
</ruleset>

16
phpunit.xml Normal file
View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
</include>
</coverage>
<testsuites>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/</directory>
</testsuite>
</testsuites>
<php>
</php>
</phpunit>

View File

View File

0
resources/lang/.gitkeep Normal file
View File

0
resources/views/.gitkeep Normal file
View File

10
src/Skeleton.php Normal file
View File

@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
namespace GKcld\Skeleton;
class Skeleton
{
// Build your next great package.
}

21
src/SkeletonFacade.php Normal file
View File

@ -0,0 +1,21 @@
<?php
declare(strict_types=1);
namespace GKcld\Skeleton;
use Illuminate\Support\Facades\Facade;
/**
* @see \GKcld\Skeleton\Skeleton
*/
class SkeletonFacade extends Facade
{
/**
* Get the registered name of the component.
*/
protected static function getFacadeAccessor(): string
{
return SkeletonServiceProvider::PACKAGE_NAME;
}
}

View File

@ -0,0 +1,73 @@
<?php
declare(strict_types=1);
namespace GKcld\Skeleton;
use Illuminate\Support\ServiceProvider;
class SkeletonServiceProvider extends ServiceProvider
{
public const PACKAGE_VENDOR = 'gkcld';
public const PACKAGE_NAME = 'skeleton';
private const COMMANDS = [
];
/**
* Bootstrap the application services.
*/
public function boot(): void
{
// Optional methods to load package assets
//$this->loadMigrationsFrom($this->getPackagePath() . '/database/migrations');
//$this->loadRoutesFrom($this->getPackagePath() . '/routes.php');
//$this->loadTranslationsFrom($this->getPackagePath() . '/resources/lang', self::PACKAGE_NAME);
//$this->loadViewsFrom($this->getPackagePath() . '/resources/views', self::PACKAGE_NAME);
if ($this->app->runningInConsole()) {
// Publish config
$this->publishes([
$this->getPackagePath() . '/config/config.php' => config_path(self::PACKAGE_NAME . '.php'),
], 'config');
// Publish assets
//$this->publishes([
// $this->getPackagePath() . '/resources/assets' => public_path('vendor/' . self::PACKAGE_NAME),
//], ['assets', 'public']);
// Publishing translation files
//$this->publishes([
// $this->getPackagePath() . '/resources/lang' => resource_path('lang/vendor/' . self::PACKAGE_NAME),
//], 'lang');
// Publishing views
//$this->publishes([
// $this->getPackagePath() . '/resources/views' => resource_path('views/vendor/' . self::PACKAGE_NAME),
//], 'views');
// Registering package commands
$this->commands(self::COMMANDS);
}
}
/**
* Register the application services.
*/
public function register(): void
{
// Automatically apply the package configuration
$this->mergeConfigFrom($this->getPackagePath() . '/config/config.php', self::PACKAGE_NAME);
// Register the main class to use with the facade
$this->app->singleton(self::PACKAGE_NAME, static function () {
return new Skeleton();
});
}
private function getPackagePath(): string
{
return realpath(__DIR__ . '/..');
}
}

0
tests/.gitkeep Normal file
View File