Skip to content

Commit 7a9c76e

Browse files
authored
Merge pull request #1 from alphaolomi/package
laravel sarufi
2 parents b0a6f8d + c6de166 commit 7a9c76e

20 files changed

+457
-10
lines changed

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 4
7+
indent_style = space
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.{yml,yaml}]
15+
indent_size = 2

.gitattributes

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Path-based git attributes
2+
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
3+
4+
# Ignore all test and documentation with "export-ignore".
5+
/.github export-ignore
6+
/.gitattributes export-ignore
7+
/.gitignore export-ignore
8+
/phpunit.xml.dist export-ignore
9+
/art export-ignore
10+
/docs export-ignore
11+
/tests export-ignore
12+
/.editorconfig export-ignore
13+
/.php_cs.dist.php export-ignore
14+
/psalm.xml export-ignore
15+
/psalm.xml.dist export-ignore
16+
/testbench.yaml export-ignore
17+
/UPGRADING.md export-ignore
18+
/phpstan.neon.dist export-ignore
19+
/phpstan-baseline.neon export-ignore

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Ask a question
4+
url: https://github.com/alphaolomi/laravel-sarufi/discussions/new?category=q-a
5+
about: Ask the community for help
6+
- name: Request a feature
7+
url: https://github.com/alphaolomi/laravel-sarufi/discussions/new?category=ideas
8+
about: Share ideas for new features
9+
- name: Report a security issue
10+
url: https://github.com/alphaolomi/laravel-sarufi/security/policy
11+
about: Learn how to notify us for sensitive bugs
12+
- name: Report a bug
13+
url: https://github.com/alphaolomi/laravel-sarufi/issues/new
14+
about: Report a reproducible bug

.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Please see the documentation for all configuration options:
2+
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
3+
4+
version: 2
5+
updates:
6+
7+
- package-ecosystem: "github-actions"
8+
directory: "/"
9+
schedule:
10+
interval: "weekly"
11+
labels:
12+
- "dependencies"
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: dependabot-auto-merge
2+
on: pull_request_target
3+
4+
permissions:
5+
pull-requests: write
6+
contents: write
7+
8+
jobs:
9+
dependabot:
10+
runs-on: ubuntu-latest
11+
if: ${{ github.actor == 'dependabot[bot]' }}
12+
steps:
13+
14+
- name: Dependabot metadata
15+
id: metadata
16+
uses: dependabot/fetch-metadata@v1.3.4
17+
with:
18+
github-token: "${{ secrets.GITHUB_TOKEN }}"
19+
20+
- name: Auto-merge Dependabot PRs for semver-minor updates
21+
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-minor'}}
22+
run: gh pr merge --auto --merge "$PR_URL"
23+
env:
24+
PR_URL: ${{github.event.pull_request.html_url}}
25+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
26+
27+
- name: Auto-merge Dependabot PRs for semver-patch updates
28+
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-patch'}}
29+
run: gh pr merge --auto --merge "$PR_URL"
30+
env:
31+
PR_URL: ${{github.event.pull_request.html_url}}
32+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Fix PHP code style issues
2+
3+
on:
4+
push:
5+
paths:
6+
- '**.php'
7+
8+
jobs:
9+
php-code-styling:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v3
15+
with:
16+
ref: ${{ github.head_ref }}
17+
18+
- name: Fix PHP code style issues
19+
uses: aglipanci/laravel-pint-action@1.0.0
20+
21+
- name: Commit changes
22+
uses: stefanzweifel/git-auto-commit-action@v4
23+
with:
24+
commit_message: Fix styling

.github/workflows/run-tests.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: run-tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: true
14+
matrix:
15+
os: [ubuntu-latest, windows-latest]
16+
php: [8.2, 8.1]
17+
laravel: [9.*]
18+
stability: [prefer-lowest, prefer-stable]
19+
include:
20+
- laravel: 9.*
21+
testbench: 7.*
22+
23+
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
24+
25+
steps:
26+
- name: Checkout code
27+
uses: actions/checkout@v3
28+
29+
- name: Setup PHP
30+
uses: shivammathur/setup-php@v2
31+
with:
32+
php-version: ${{ matrix.php }}
33+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
34+
coverage: none
35+
36+
- name: Setup problem matchers
37+
run: |
38+
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
39+
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
40+
41+
- name: Install dependencies
42+
run: |
43+
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
44+
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
45+
46+
- name: List Installed Dependencies
47+
run: composer show -D
48+
49+
- name: Execute tests
50+
run: vendor/bin/pest
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: "Update Changelog"
2+
3+
on:
4+
release:
5+
types: [released]
6+
7+
jobs:
8+
update:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v3
14+
with:
15+
ref: main
16+
17+
- name: Update Changelog
18+
uses: stefanzweifel/changelog-updater-action@v1
19+
with:
20+
latest-version: ${{ github.event.release.name }}
21+
release-notes: ${{ github.event.release.body }}
22+
23+
- name: Commit updated CHANGELOG
24+
uses: stefanzweifel/git-auto-commit-action@v4
25+
with:
26+
branch: main
27+
commit_message: Update CHANGELOG
28+
file_pattern: CHANGELOG.md

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ phpunit.xml
88
phpstan.neon
99
testbench.yaml
1010
vendor
11-
node_modules
11+
node_modules

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Changelog
2+
3+
All notable changes to `laravel-sarufi` will be documented in this file.

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) Alpha Olomi
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ composer require alphaolomi/laravel-sarufi
1515

1616

1717
```bash
18-
php artisan vendor:publish --tag="laravel-sarufi-config"
18+
php artisan vendor:publish --tag="sarufi-config"
1919
```
2020

2121
## Configuration
@@ -30,15 +30,31 @@ SARUFI_PASSWORD="your_nice_password"
3030
## Usage
3131

3232
```php
33-
use Alphaolomi\Laravel\Facades\Sarufi;
34-
$bot = Sarufi::createBot([
35-
"name" => "YOUR AWESOME BOT NAME",
36-
"description" => "PUT DESCRIPTION HERE",
37-
"industry" => "YOUR BOT INDUSTRY",
38-
"intents" => [],
39-
"flows" => [],
40-
]);
33+
use Alphaolomi\Laravel\Sarufi\Facades\Sarufi;
34+
$bot = Sarufi::createBot(
35+
name: "Danny bot",
36+
description: "PUT DESCRIPTION HERE",
37+
industry: "YOUR BOT INDUSTRY",
38+
intents: [],
39+
flows: []
40+
);
41+
4142
print_r($bot1);
43+
// Output
44+
// => [
45+
// "intents" => [],
46+
// "user_id" => 54,
47+
// "description" => "PUT DESCRIPTION HERE",
48+
// "industry" => "YOUR BOT INDUSTRY",
49+
// "created_at" => "2022-10-20T14:24:32.862859",
50+
// "name" => "Danny bot",
51+
// "flows" => [],
52+
// "id" => 81,
53+
// "model_name" => "models/24bea90e2ad6f9d279d4fa86795c8ea0.pkl",
54+
// "visible_on_community" => false,
55+
// "updated_at" => "2022-10-20T14:24:32.862872",
56+
// ]
57+
4258

4359
// OR
4460
// From files with intent and metadata/

composer.json

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"name": "alphaolomi/laravel-sarufi",
3+
"description": "Sarufi for Laravel",
4+
"keywords": [
5+
"sarufi",
6+
"laravel-sarufi"
7+
],
8+
"homepage": "https://github.com/alphaolomi/laravel-sarufi",
9+
"license": "MIT",
10+
"authors": [
11+
{
12+
"name": "Alpha Olomi",
13+
"email": "alphaolomi@gmail.com",
14+
"role": "Developer"
15+
}
16+
],
17+
"require": {
18+
"php": "^8.1",
19+
"alphaolomi/sarufi-php": "^0.0.1",
20+
"illuminate/contracts": "^9.0",
21+
"spatie/laravel-package-tools": "^1.13.0"
22+
},
23+
"require-dev": {
24+
"laravel/pint": "^1.0",
25+
"nunomaduro/collision": "^6.0",
26+
"orchestra/testbench": "^7.0",
27+
"pestphp/pest": "^1.21",
28+
"pestphp/pest-plugin-laravel": "^1.1",
29+
"phpunit/phpunit": "^9.5"
30+
},
31+
"autoload": {
32+
"psr-4": {
33+
"Alphaolomi\\Laravel\\Sarufi\\": "src"
34+
}
35+
},
36+
"autoload-dev": {
37+
"psr-4": {
38+
"Alphaolomi\\Laravel\\Sarufi\\Tests\\": "tests"
39+
}
40+
},
41+
"scripts": {
42+
"post-autoload-dump": "@php ./vendor/bin/testbench package:discover --ansi",
43+
"analyse": "vendor/bin/phpstan analyse",
44+
"test": "vendor/bin/pest",
45+
"test-coverage": "vendor/bin/pest --coverage",
46+
"format": "vendor/bin/pint"
47+
},
48+
"config": {
49+
"sort-packages": true,
50+
"allow-plugins": {
51+
"pestphp/pest-plugin": true,
52+
"phpstan/extension-installer": true
53+
}
54+
},
55+
"extra": {
56+
"laravel": {
57+
"providers": [
58+
"Alphaolomi\\Laravel\\Sarufi\\SarufiServiceProvider"
59+
],
60+
"aliases": {
61+
"Sarufi": "Alphaolomi\\Laravel\\Sarufi\\Facades\\Sarufi"
62+
}
63+
}
64+
},
65+
"minimum-stability": "dev",
66+
"prefer-stable": true
67+
}

config/sarufi.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
return [
4+
5+
/*
6+
* Sarudi Username
7+
*/
8+
'username' => env('SARUFI_USERNAME'),
9+
10+
/*
11+
* Sarudi Password
12+
*/
13+
'password' => env('SARUFI_PASSWORD'),
14+
15+
];

0 commit comments

Comments
 (0)