Skip to content

Commit 8214281

Browse files
committed
Initial commit
0 parents  commit 8214281

16 files changed

+4640
-0
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+
indent_size = 4
6+
indent_style = space
7+
end_of_line = lf
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

.github/workflows/run-tests.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Tests
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
fail-fast: true
10+
matrix:
11+
os: [ubuntu-latest, windows-latest]
12+
php: [7.2, 8.0]
13+
stability: [prefer-lowest, prefer-stable]
14+
15+
name: P${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }}
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v2
20+
21+
- name: Setup PHP
22+
uses: shivammathur/setup-php@v2
23+
with:
24+
php-version: ${{ matrix.php }}
25+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
26+
coverage: none
27+
28+
- name: Setup problem matchers
29+
run: |
30+
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
31+
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
32+
33+
- name: Install dependencies
34+
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction
35+
36+
- name: Execute tests
37+
run: composer test
38+
env:
39+
JOTFORM_API_KEY: ${{ secrets.JOTFORM_API_KEY }}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.DS_Store
2+
.idea
3+
/node_modules
4+
/vendor

.php_cs.dist.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
$finder = Symfony\Component\Finder\Finder::create()
4+
->in([
5+
__DIR__ . '/src',
6+
__DIR__ . '/tests',
7+
])
8+
->name('*.php')
9+
->notName('*.blade.php')
10+
->ignoreDotFiles(true)
11+
->ignoreVCS(true);
12+
13+
return (new PhpCsFixer\Config())
14+
->setRules([
15+
'@PSR12' => true,
16+
'array_syntax' => ['syntax' => 'short'],
17+
'ordered_imports' => ['sort_algorithm' => 'alpha'],
18+
'no_unused_imports' => true,
19+
'not_operator_with_successor_space' => true,
20+
'trailing_comma_in_multiline' => true,
21+
'phpdoc_scalar' => true,
22+
'unary_operator_spaces' => true,
23+
'binary_operator_spaces' => true,
24+
'blank_line_before_statement' => [
25+
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'],
26+
],
27+
'phpdoc_single_line_var_spacing' => true,
28+
'phpdoc_var_without_name' => true,
29+
'class_attributes_separation' => [
30+
'elements' => [
31+
'method' => 'one',
32+
],
33+
],
34+
'method_argument_space' => [
35+
'on_multiline' => 'ensure_fully_multiline',
36+
'keep_multiple_spaces_after_comma' => true,
37+
],
38+
'single_trait_insert_per_statement' => true,
39+
])
40+
->setFinder($finder);

.phpunit.result.cache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"version":1,"defects":{"Jotform\\Tests\\ServiceTest::test_get_api_url":3,"Jotform\\Tests\\ServiceTest::test_get_all_forms_for_user":4,"Jotform\\Tests\\ServiceTest::test_get_user_form_by_id":5},"times":{"Jotform\\Tests\\ServiceTest::test_get_api_url":0,"Jotform\\Tests\\ServiceTest::test_get_all_forms_for_user":0.778,"Jotform\\Tests\\ServiceTest::test_get_user_form_by_id":0.645}}

README.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Jotform - Laravel Package
2+
3+
This package allows you able to use Jotform API in Laravel.
4+
5+
## Installation
6+
*Supported Laravel Versions:* **>= 6.x**
7+
8+
Run the following command directly in your Project path:
9+
10+
```
11+
$ composer require izniburak/laravel-jotform
12+
```
13+
14+
The service provider of the Package will be **automatically discovered** by Laravel.
15+
16+
After that, you should publish the config file via following command:
17+
18+
```
19+
$ php artisan vendor:publish --provider="Jotform\JotformServiceProvider"
20+
```
21+
Greate! You can start to use **Laravel Jotform** Package.
22+
23+
## Usage
24+
1- You can use `jotform()` helper function in order to access Jotform API:
25+
```php
26+
<?php
27+
# in routes/web.php or routes/api.php
28+
29+
Route::get('my-forms', function() {
30+
$myForms = jotform()->getForms();
31+
return response()->json($myForms);
32+
});
33+
```
34+
2- You can use Facade:
35+
```php
36+
<?php
37+
# in routes/web.php or routes/api.php
38+
39+
use Jotform\Facade\Jotform;
40+
41+
Route::get('my-forms', function() {
42+
$myForms = Jotform::getForms();
43+
return response()->json($myForms);
44+
});
45+
```
46+
You can find all methods that will be able to use with this package by using [this documentation](https://github.com/jotform/jotform-api-php).
47+
48+
## Config
49+
You can change the package configs via `config/jotform.php` file or directly using `.env` file variables.
50+
You can add the variables below in your `.env` file and configure it as you desire.
51+
52+
```
53+
JOTFORM_API_KEY=<YOUR_API_KEY>
54+
JOTFORM_OUTPUT=json
55+
JOTFORM_DEBUG=false
56+
```
57+
58+
## Licence
59+
[MIT Licence](http://opensource.org/licenses/MIT)
60+
61+
## Contributing
62+
63+
1. Fork it ( https://github.com/izniburak/laravel-jotform/fork )
64+
2. Create your feature branch (git checkout -b my-new-feature)
65+
3. Commit your changes (git commit -am 'Add some feature')
66+
4. Push to the branch (git push origin my-new-feature)
67+
5. Create a new Pull Request
68+
69+
## Contributors
70+
71+
- [izniburak](https://github.com/izniburak) İzni Burak Demirtaş - creator, maintainer
72+

composer.json

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
"name": "jotform/laravel-jotform",
3+
"description": "Jotform Laravel Package",
4+
"keywords": [
5+
"jotform",
6+
"form",
7+
"laravel"
8+
],
9+
"type": "library",
10+
"license": "MIT",
11+
"homepage": "https://github.com/jotform/laravel-jotform",
12+
"authors": [
13+
{
14+
"name": "İzni Burak Demirtaş",
15+
"email": "info@burakdemirtas.org",
16+
"homepage": "https://burakdemirtas.org"
17+
}
18+
],
19+
"require": {
20+
"php": "^7.2.5|^8.0",
21+
"jotform/jotform-api-php": "dev-master"
22+
},
23+
"require-dev": {
24+
"friendsofphp/php-cs-fixer": "^3.0",
25+
"phpunit/phpunit": "^8.5.19|^9.5.8"
26+
},
27+
"autoload": {
28+
"psr-4": {
29+
"Jotform\\": "src/"
30+
},
31+
"files": [
32+
"src/helpers.php"
33+
]
34+
},
35+
"autoload-dev": {
36+
"psr-4": {
37+
"Jotform\\Tests\\": "tests/"
38+
}
39+
},
40+
"scripts": {
41+
"test": "./vendor/bin/phpunit",
42+
"coverage": "vendor/bin/phpunit --coverage-html coverage",
43+
"format": "vendor/bin/php-cs-fixer fix --allow-risky=yes"
44+
},
45+
"extra": {
46+
"laravel": {
47+
"providers": [
48+
"Jotform\\JotformServiceProvider"
49+
],
50+
"aliases": {
51+
"Jotform": "Jotform\\Facade\\Jotform"
52+
}
53+
}
54+
},
55+
"minimum-stability": "dev",
56+
"prefer-stable": true,
57+
"config": {
58+
"sort-packages": true
59+
}
60+
}

0 commit comments

Comments
 (0)