Commit 0c1bf114 authored by Dillenn Terumalai's avatar Dillenn Terumalai
Browse files

Initial commit

parent 9c6f5de9
github: :vendor_name
blank_issues_enabled: false
contact_links:
- name: Ask a question
url: https://github.com/:vendor_name/:package_name/discussions/new?category=q-a
about: Ask the community for help
- name: Request a feature
url: https://github.com/:vendor_name/:package_name/discussions/new?category=ideas
about: Share ideas for new features
- name: Report a security issue
url: https://github.com/:vendor_name/:package_name/security/policy
about: Learn how to notify us for sensitive bugs
- name: Report a bug
url: https://github.com/:vendor_name/:package_name/issues/new
about: Report a reproducable bug
# Security Policy
If you discover any security related issues, please email author@domain.com instead of using the issue tracker.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
labels:
- "dependencies"
\ No newline at end of file
name: dependabot-auto-merge
on: pull_request_target
permissions:
pull-requests: write
contents: write
jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1.1.1
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Auto-merge Dependabot PRs for semver-minor updates
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-minor'}}
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Auto-merge Dependabot PRs for semver-patch updates
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-patch'}}
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
name: Check & fix styling
on: [push]
jobs:
php-cs-fixer:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Run PHP CS Fixer
uses: docker://oskarstark/php-cs-fixer-ga
with:
args: --config=.php_cs.dist.php --allow-risky=yes
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Fix styling
name: PHPStan
on:
push:
paths:
- '**.php'
- 'phpstan.neon.dist'
jobs:
phpstan:
name: phpstan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
coverage: none
- name: Install composer dependencies
uses: ramsey/composer-install@v1
- name: Run PHPStan
run: ./vendor/bin/phpstan --error-format=github
name: run-tests
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
php: [8.0]
laravel: [8.*]
stability: [prefer-lowest, prefer-stable]
include:
- laravel: 8.*
testbench: ^6.23
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
coverage: none
- name: Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
- name: Execute tests
run: vendor/bin/pest
name: "Update Changelog"
on:
release:
types: [released]
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: main
- name: Update Changelog
uses: stefanzweifel/changelog-updater-action@v1
with:
latest-version: ${{ github.event.release.name }}
release-notes: ${{ github.event.release.body }}
- name: Commit updated CHANGELOG
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: main
commit_message: Update CHANGELOG
file_pattern: CHANGELOG.md
### Summary
<!-- Summarize the bug encountered concisely -->
### Steps to reproduce
<!-- How one can reproduce the issue - this is very important -->
### What is the current *bug* behavior?
<!-- What actually happens -->
### What is the expected *correct* behavior?
<!-- What you should see instead -->
### Relevant screenshots and/or logs
<!-- Paste any relevant screenshots -->
/label ~Bug
/assign @dterumal
\ No newline at end of file
### Problem to solve
<!-- What problem do we solve? -->
### Further details
<!-- Include use cases, benefits, and/or goals -->
### Proposal
<!-- What do you propose to solve this problem? -->
### Links / references
<!-- Provide any screenshot or links to websites that may be relevant to your proposal -->
/label ~Feature
/assign @dterumal
\ No newline at end of file
# Changelog # Changelog
All notable changes to `:package_name` will be documented in this file. All notable changes to `laravel-installer` will be documented in this file.
## 1.0.0 - 202X-XX-XX ## 1.0.0 - 202X-XX-XX
......
The MIT License (MIT) The MIT License (MIT)
Copyright (c) :vendor_name <author@domain.com> Copyright (c) dterumal <dillenn.terumalai@sib.swiss>
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
......
# :package_description <p align="center"><img src="https://banners.beyondco.de/Laravel%20Installer.png?theme=light&packageManager=composer+require&packageName=dterumal%2Flaravel-installer&pattern=architect&style=style_1&description=A+web+installer+for+your+Laravel+application&md=1&showWatermark=1&fontSize=100px&images=fast-forward"></p>
[![Latest Version on Packagist](https://img.shields.io/packagist/v/:vendor_slug/:package_slug.svg?style=flat-square)](https://packagist.org/packages/:vendor_slug/:package_slug) ## Introduction
[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/:vendor_slug/:package_slug/run-tests?label=tests)](https://github.com/:vendor_slug/:package_slug/actions?query=workflow%3Arun-tests+branch%3Amain)
[![GitHub Code Style Action Status](https://img.shields.io/github/workflow/status/:vendor_slug/:package_slug/Check%20&%20fix%20styling?label=code%20style)](https://github.com/:vendor_slug/:package_slug/actions?query=workflow%3A"Check+%26+fix+styling"+branch%3Amain)
[![Total Downloads](https://img.shields.io/packagist/dt/:vendor_slug/:package_slug.svg?style=flat-square)](https://packagist.org/packages/:vendor_slug/:package_slug)
<!--delete-->
---
This repo can be used to scaffold a Laravel package. Follow these steps to get started:
1. Press the "Use template" button at the top of this repo to create a new repo with the contents of this skeleton Laravel Installer provides an easy way to add an installation wizard to your application. It will guide the user through multiple steps to ensure that everything is properly working and finally, it will create a first user.
2. Run "php ./configure.php" to run a script that will replace all placeholders throughout all the files
3. Remove this block of text.
4. Have fun creating your package.
5. If you need help creating a package, consider picking up our <a href="https://laravelpackage.training">Laravel Package Training</a> video course.
---
<!--/delete-->
This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.
## Support us
[<img src="https://github-ads.s3.eu-central-1.amazonaws.com/:package_name.jpg?t=1" width="419px" />](https://spatie.be/github-ad-click/:package_name)
We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).
We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).
## Installation ## Installation
You can install the package via composer: You can install the package via composer:
```bash ```bash
composer require :vendor_slug/:package_slug composer require dterumal/laravel-installer
``` ```
You can publish and run the migrations with: You can publish all the required files with:
```bash ```bash
php artisan vendor:publish --tag=":package_slug_without_prefix-migrations" php artisan laravel-installer:install
php artisan migrate
``` ```
You can publish the config file with: You can publish the config file with:
```bash ```bash
php artisan vendor:publish --tag=":package_slug_without_prefix-config" php artisan vendor:publish --tag="laravel-installer_without_prefix-config"
``` ```
Optionally, you can publish the views using Optionally, you can publish the assets using
```bash ```bash
php artisan vendor:publish --tag="example-views" php artisan laravel-installer:publish
``` ```
This is the contents of the published config file: This is the contents of the published config file:
```php ```php
return [ return [
/*
|--------------------------------------------------------------------------
| Server Requirements
|--------------------------------------------------------------------------
|
| This is the default Laravel server requirements, you can add as many
| as your application require, we check if the extension is enabled
| by looping through the array and run "extension_loaded" on it.
|
*/
'version' => '7.4.0',
'extensions' => [
'bcmath',
'ctype',
'fileinfo',
'json',
'mbstring',
'openssl',
'pdo',
'tokenizer',
'xml',
],
/*
|--------------------------------------------------------------------------
| URLs
|--------------------------------------------------------------------------
|
| Those are the URLs that we will show and use during the installation.
| Help URL should a support link. If not provided, we won't show it.
| Finally Login URL is the final callback URL.
|
*/
'help_url' => null,
'login_url' => '/login'
]; ];
``` ```
## Usage ## Usage
```php The Laravel Installer will guide the user through multiple steps to make sure that the server is properly configured, the database is available and finally, it will create a first user.
$skeleton = new VendorName\Skeleton();
echo $skeleton->echoPhrase('Hello, VendorName!'); When the installation process is completed, a `.installed` file will be created inside `storage/app`. The presence of the file will act as the only check for the package to know whether the app is installed or not.
```
## Testing ## Testing
...@@ -77,7 +91,7 @@ Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed re ...@@ -77,7 +91,7 @@ Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed re
## Contributing ## Contributing
Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details. Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
## Security Vulnerabilities ## Security Vulnerabilities
...@@ -85,8 +99,7 @@ Please review [our security policy](../../security/policy) on how to report secu ...@@ -85,8 +99,7 @@ Please review [our security policy](../../security/policy) on how to report secu
## Credits ## Credits
- [:author_name](https://github.com/:author_username) - [dterumal](https://gitlab.sib.swiss/dterumal)
- [All Contributors](../../contributors)
## License ## License
......
# Security Policy
If you discover any security related issues, please email dillenn.terumalai@sib.swiss instead of using the issue tracker.
{ {
"name": ":vendor_slug/:package_slug", "name": "dterumal/laravel-installer",
"description": ":package_description", "description": "Laravel Installer provides an easy way to install your Laravel application",
"keywords": [ "keywords": [
":vendor_name", "dterumal",
"laravel", "laravel",
":package_slug" "laravel-installer"
], ],
"homepage": "https://github.com/:vendor_slug/:package_slug", "homepage": "https://gitlab.sib.swiss/clinbio/packagist/laravel-installer",
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{ {
"name": ":author_name", "name": "dterumal",
"email": "author@domain.com", "email": "dillenn.terumalai@sib.swiss",
"role": "Developer" "role": "Developer"
} }
], ],
"require": { "require": {
"php": "^8.0", "php": "^7.4|^8.0",
"spatie/laravel-package-tools": "^1.9.2",
"illuminate/contracts": "^8.73" "illuminate/contracts": "^8.73"
}, },
"require-dev": { "require-dev": {
...@@ -30,20 +29,25 @@ ...@@ -30,20 +29,25 @@
"phpstan/phpstan-deprecation-rules": "^1.0", "phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-phpunit": "^1.0", "phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^9.5", "phpunit/phpunit": "^9.5",
"spatie/laravel-ray": "^1.26" "spatie/laravel-ray": "^1.26",
"vimeo/psalm": "^4.15"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"VendorName\\Skeleton\\": "src", "Dterumal\\LaravelInstaller\\": "src",
"VendorName\\Skeleton\\Database\\Factories\\": "database/factories" "Dterumal\\LaravelInstaller\\Database\\Factories\\": "database/factories"
} },
"files": [
"src/helpers.php"
]
}, },
"autoload-dev": { "autoload-dev": {
"psr-4": { "psr-4": {
"VendorName\\Skeleton\\Tests\\": "tests" "Dterumal\\LaravelInstaller\\Tests\\": "tests"
} }
}, },
"scripts": { "scripts": {
"psalm": "vendor/bin/psalm",
"analyse": "vendor/bin/phpstan analyse", "analyse": "vendor/bin/phpstan analyse",
"test": "vendor/bin/pest", "test": "vendor/bin/pest",
"test-coverage": "vendor/bin/pest coverage" "test-coverage": "vendor/bin/pest coverage"
...@@ -54,10 +58,10 @@ ...@@ -54,10 +58,10 @@
"extra": { "extra": {
"laravel": { "laravel": {
"providers": [ "providers": [
"VendorName\\Skeleton\\SkeletonServiceProvider" "Dterumal\\LaravelInstaller\\LaravelInstallerServiceProvider"
], ],
"aliases": { "aliases": {
"Skeleton": "VendorName\\Skeleton\\Facades\\Skeleton" "LaravelInstaller": "Dterumal\\LaravelInstaller\\Facades\\LaravelInstaller"
} }
} }
}, },
......
<?php
return [
/*
|--------------------------------------------------------------------------
| Server Requirements
|--------------------------------------------------------------------------
|
| This is the default Laravel server requirements, you can add as many
| as your application require, we check if the extension is enabled
| by looping through the array and run "extension_loaded" on it.
|
*/
'version' => '7.4.0',
'extensions' => [
'bcmath',
'ctype',
'fileinfo',
'json',
'mbstring',
'openssl',
'pdo',
'tokenizer',
'xml',
],
/*
|--------------------------------------------------------------------------
| URLs
|--------------------------------------------------------------------------
|
| Those are the URLs that we will show and use during the installation.
| Help URL should a support link. If not provided, we won't show it.
| Finally Login URL is the final callback URL.
|
*/
'help_url' => null,
'login_url' => '/login'
];
<?php
// config for VendorName/Skeleton
return [
];
#!/usr/bin/env php
<?php
function ask(string $question, string $default = ''): string {
$answer = readline($question . ($default ? " ({$default})" : null) . ': ');
if (! $answer) {
return $default;
}
return $answer;
}
function confirm(string $question, bool $default = false): bool {
$answer = ask($question . ' (' . ($default ? 'Y/n' : 'y/N') . ')');
if (! $answer) {
return $default;
}
return strtolower($answer) === 'y';
}
function writeln(string $line): void {
echo $line . PHP_EOL;
}
function run(string $command): string {
return trim(shell_exec($command));
}
function str_after(string $subject, string $search): string {
$pos = strrpos($subject, $search);