Skip to content

Commit

Permalink
feat: Initial implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
seebeen committed Sep 24, 2023
1 parent 52511ff commit f6fec5e
Show file tree
Hide file tree
Showing 14 changed files with 1,139 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# editorconfig.org

root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.php]
indent_size = 4

[phpcs.xml]
indent_size = 4
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.phpcs.xml export-ignore
4 changes: 4 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["config:base"]
}
25 changes: 25 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Release
on:
workflow_dispatch:
push:
branches:
- master
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.OBLAK_BOT_TOKEN }}
- name: Publish a composer package
uses: better-php-actions/publish-composer-package@v1
with:
package_slug: "whmcs-utils"
package_name: "WHMCS Utils"
with_gpg: true
gpg_key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg_passphrase: ${{ secrets.GPG_PASSPHRASE }}
release_token: ${{ secrets.OBLAK_BOT_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.vscode
vendor
25 changes: 25 additions & 0 deletions .phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0"?>
<ruleset name="composer-installer">
<description>Coding standards for AutoConstructor Composer Plugin</description>

<arg name="extensions" value="php"/>
<!-- Show sniff codes in all reports, and progress when running -->
<arg value="sp"/>
<!-- Strip the filepaths down to the relevant bit. -->
<arg name="basepath" value="."/>

<file>.</file>
<exclude-pattern>*/.git*</exclude-pattern>
<exclude-pattern>*/build/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>

<rule ref="PSR12"/>

<rule ref="Generic.Formatting.MultipleStatementAlignment">
<properties>
<property name="maxPadding" value="40" />
</properties>
</rule>


</ruleset>
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<div align="center">

# WHMCS Module Utilities

</div>

A collection of base classes that will help you to create your own WHMCS modules.
45 changes: 45 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name": "oblak/whmcs-utils",
"description": "WHMCS Addon Utility classes and functions",
"version": "1.0.0",
"type": "library",
"license": "MIT",
"authors": [
{
"name": "Sibin Grasic",
"email": "sibin.grasic@oblak.studio",
"homepage": "https://oblak.host"
}
],
"keywords": [
"whmcs",
"addon",
"utility"
],
"support": {
"issues": "https://github.com/oblakhost/whmcs-utils"
},
"autoload": {
"psr-4": {
"Oblak\\WHMCS\\": "src"
}
},
"require": {
"php": "^8.0|^8.1"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
"squizlabs/php_codesniffer": "3.7.1"
},
"config": {
"optimize-autoloader": true,
"classmap-authoritative": true,
"preferred-install": "dist",
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
155 changes: 155 additions & 0 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions src/Hooks/HookManager.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

/**
* HookManager class file
*
* @package WHMCS Utils
*/

namespace Oblak\WHMCS\Hooks;

use Oblak\WHMCS\Traits\Singleton;

/**
* Instatiates all the hooks
*/
class HookManager
{
use Singleton;

/**
* Hooks to be loaded
*
* @var Hookable[]
*/
protected $hooks = [];

/**
* Class constructor
*/
protected function __construct()
{
}

public function registerHooks(string $module, string ...$hooks): void
{
foreach ($hooks as $hook) {
$this->hooks[$module][] = new $hook();
}
}
}
Loading

0 comments on commit f6fec5e

Please sign in to comment.