Skip to content

Commit

Permalink
publish CodeIgniter4 SMSRocket
Browse files Browse the repository at this point in the history
  • Loading branch information
datamweb committed Oct 14, 2024
0 parents commit d80431a
Show file tree
Hide file tree
Showing 95 changed files with 7,642 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
; 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

[*.{yml,yaml}]
indent_size = 2
24 changes: 24 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/.github export-ignore
/admin export-ignore
/bin export-ignore
/tests export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.php-cs-fixer.dist.php export-ignore
/composer-unused.php export-ignore
/deptrac.yml export-ignore
/infection.json.dist export-ignore
/mkdocs.yml export-ignore
/phpstan-baseline.php export-ignore
/phpstan.neon.dist export-ignore
/phpunit.xml.dist export-ignore
/psalm_autoload.php export-ignore
/psalm-baseline.xml export-ignore
/psalm.xml export-ignore
/rector.php export-ignore
/roave-bc-check.yml export-ignore

# Configure diff output for .php and .phar files.
*.php diff=php
*.phar -diff
115 changes: 115 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: Bug report
description: Create a report to help us improve CodeIgniter4 SMSRocket
title: "Bug: "
labels: ['bug']

body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
Before you begin, **please ensure that there are no existing issues,
whether still open or closed, related to your report**.
If there is, your report will be closed promptly.
For example, if you get the error "*Can't find a route for 'post: login'*",
you can search the GitHub repository with the keyword "[Can't find a route for](https://github.com/datamweb/sms-rocket/issues?q=Can%27t+find+a+route+for)".
---
- type: input
id: php-version
attributes:
label: PHP Version
description: |
e.g. 8.1.0
validations:
required: true

- type: input
id: codeigniter-version
attributes:
label: CodeIgniter4 Version
description: |
e.g. 4.5.0
validations:
required: true

- type: input
id: SMSRocket-version
attributes:
label: CodeIgniter4 SMSRocket
description: |
e.g. 1.0.0
If you are not using the [latest version](https://github.com/datamweb/sms-rocket/releases), please
check to see if the problem occurs with the latest version.
validations:
required: true

- type: dropdown
id: operating-systems
attributes:
label: Which operating systems have you tested for this bug?
description: You may select more than one.
multiple: true
options:
- macOS
- Windows
- Linux
validations:
required: true

- type: dropdown
id: server
attributes:
label: Which server did you use?
options:
- apache
- cli
- cli-server (PHP built-in webserver)
- cgi-fcgi
- fpm-fcgi
- phpdbg
validations:
required: true

- type: input
id: database
attributes:
label: Database
description: e.g. MySQL 5.6, MariaDB 10.2, PostgreSQL 9.6
validations:
required: true

- type: textarea
id: description
attributes:
label: What happened?
placeholder: Tell us what you see!
validations:
required: true

- type: textarea
attributes:
label: Steps to Reproduce
description: Steps to reproduce the behavior.
validations:
required: true

- type: textarea
attributes:
label: Expected Output
description: What do you expect to happen instead of this filed bug?
validations:
required: true

- type: textarea
attributes:
label: Anything else?
description: |
Links? References? Anything that will give us more context about the issue you are encountering!
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
validations:
required: false
9 changes: 9 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
blank_issues_enabled: false
contact_links:
- name: GitHub Discussions
url: https://github.com/datamweb/sms-rocket/discussions
about: Please ask your support questions in the Discussions. Thanks!

- name: CodeIgniter Slack channel
url: https://join.slack.com/t/codeigniterchat/shared_invite/zt-244xrrslc-l_I69AJSi5y2a2RVN~xIdQ
about: Engage with other members of the community in our Slack channel.
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: Feature request
about: How to submit a feature request
title: ''
labels: ''
assignees: ''

---

Please submit feature requests to [Discussions](https://github.com/datamweb/sms-rocket/discussions/categories/ideas).
We use GitHub Issues to track bugs and planned work.
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/planned-work.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: Planned work
about: Approved work planning
title: 'Dev: '
labels: dev
assignees: ''

---

Repo maintainers will create "issues" for planned work, so it can be tracked.
32 changes: 32 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
version: 2
updates:
- package-ecosystem: composer
directory: "/"
schedule:
interval: daily
time: "08:30"
timezone: "Asia/Tehran"
open-pull-requests-limit: 5
target-branch: "develop"
reviewers:
- "datamweb"
assignees:
- "datamweb"
labels:
- "dependa bot"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: daily
time: "08:30"
timezone: "Asia/Tehran"
open-pull-requests-limit: 5
target-branch: "develop"
reviewers:
- "datamweb"
assignees:
- "datamweb"
labels:
- "dependa bot"

8 changes: 8 additions & 0 deletions .github/prlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"title": [
{
"pattern": "^(\\[\\d+\\.\\d+\\]\\s{1})?(feat|fix|chore|docs|perf|refactor|style|test)(\\([\\-.@:`a-zA-Z0-9]+\\))?!?:\\s{1}\\S.+\\S$",
"message": "PR title must include the type (feat, fix, chore, docs, perf, refactor, style, test) of the commit per Conventional Commits specification. See https://www.conventionalcommits.org/en/v1.0.0/ for the discussion."
}
]
}
26 changes: 26 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
changelog:
exclude:
authors:
- dependabot
categories:
- title: Breaking Changes
labels:
- 'breaking change'
- title: Fixed Bugs
labels:
- bug
- title: New Features
labels:
- 'new feature'
- title: Enhancements
labels:
- enhancement
- title: Translations
labels:
- lang
- title: Refactoring
labels:
- refactor
- title: Others (Only for checking. Remove this category)
labels:
- "*"
122 changes: 122 additions & 0 deletions .github/scripts/CopyrightYearUpdater.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
<?php

declare(strict_types=1);

/**
* This file is part of CodeIgniter SMSRocket.
*
* (c) Pooya Parsa Dadashi <[email protected]>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/

/**
* Class CopyrightYearUpdater
*
* This class updates the copyright years in specified files.
*/
class CopyrightYearUpdater
{
private const SKIP_PHRASES = [
'Lonnie Ezell',
'British Columbia Institute of Technology',
];

private string $currentYear;
private array $files;

public function __construct(string $currentYear, array $files)
{
$this->currentYear = $currentYear;
$this->files = $files;
}

public function run(): void
{
foreach ($this->files as $file) {
$this->processFile($file);
}
}

private function processFile(string $file): void
{
if (! file_exists($file)) {
echo "File {$file} not found. Skipping...\n";

return;
}

try {
$content = $this->readFileContent($file);
$updatedContent = $this->updateCopyright($content);
$this->writeFileContent($file, $updatedContent);

echo "Updated {$file} with copyright year {$this->currentYear}\n";
} catch (Exception $e) {
echo "An error occurred while processing {$file}: " . $e->getMessage() . "\n";
}
}

private function readFileContent(string $file): string
{
$content = file_get_contents($file);
if ($content === false) {
throw new Exception("Failed to read file {$file}");
}

return $content;
}

private function writeFileContent(string $file, string $content): void
{
if (file_put_contents($file, $content) === false) {
throw new Exception("Failed to write to file {$file}");
}
}

private function updateCopyright(string $content): string
{
$skipPattern = implode('|', array_map('preg_quote', self::SKIP_PHRASES));
$pattern = "/(\\d{4})(?:-(\\d{4}))?(?![^<]*?({$skipPattern}))/";

return preg_replace_callback($pattern, function (array $matches): string {
if ($this->shouldSkipUpdate($matches[0])) {
return $matches[0];
}

$startYear = $matches[1];
$endYear = $matches[2] ?? null;

if ($endYear && $endYear < $this->currentYear) {
return "{$startYear}-" . $this->currentYear;
}
if (! $endYear && $startYear < $this->currentYear) {
return "{$startYear}-" . $this->currentYear;
}

return $matches[0];
}, $content);
}

private function shouldSkipUpdate(string $line): bool
{
foreach (self::SKIP_PHRASES as $phrase) {
if (str_contains($line, $phrase)) {
return true;
}
}

return false;
}
}

// Get the current year
$currentYear = date('Y');

// Files to update
$files = ['mkdocs.yml', 'LICENSE'];

// Create an instance of the class and run the update
$updater = new CopyrightYearUpdater($currentYear, $files);
$updater->run();
Loading

0 comments on commit d80431a

Please sign in to comment.