Skip to content

Commit

Permalink
Merge pull request #1 from chrisreedio/dev
Browse files Browse the repository at this point in the history
Base Package Integration + README Updates
  • Loading branch information
chrisreedio committed Feb 22, 2024
2 parents ed99a6c + e600c33 commit 830dc55
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 25 deletions.
22 changes: 6 additions & 16 deletions README.md
Expand Up @@ -5,15 +5,9 @@
[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/chrisreedio/laravel-jotform-sdk/fix-php-code-style-issues.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/chrisreedio/laravel-jotform-sdk/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain)
[![Total Downloads](https://img.shields.io/packagist/dt/chrisreedio/laravel-jotform-sdk.svg?style=flat-square)](https://packagist.org/packages/chrisreedio/laravel-jotform-sdk)

This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.
This package provides a Laravel wrapper for the Jotform SDK/API.

## Support us

[<img src="https://github-ads.s3.eu-central-1.amazonaws.com/laravel-jotform-sdk.jpg?t=1" width="419px" />](https://spatie.be/github-ad-click/laravel-jotform-sdk)

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).
The goal is to streamline the usage in a Laravel application by auto-injecting the API key from the config file.

## Installation

Expand All @@ -40,20 +34,16 @@ This is the contents of the published config file:

```php
return [
'api_key' => env('JOTFORM_API_KEY'),
];
```

Optionally, you can publish the views using

```bash
php artisan vendor:publish --tag="laravel-jotform-sdk-views"
```

## Usage

```php
$jotformSDK = new ChrisReedIO\JotformSDK();
echo $jotformSDK->echoPhrase('Hello, ChrisReedIO!');
use ChrisReedIO\JotformSDK\Facades\JotformSDK;
$folders = JotformSDK::api()
->getFolders();
```

## Testing
Expand Down
8 changes: 5 additions & 3 deletions composer.json
Expand Up @@ -17,8 +17,10 @@
],
"require": {
"php": "^8.1",
"spatie/laravel-package-tools": "^1.14.0",
"illuminate/contracts": "^10.0"
"chrisreedio/jotform-api-php": "^1.0",
"illuminate/contracts": "^10.0",
"saloonphp/laravel-plugin": "^3.0",
"spatie/laravel-package-tools": "^1.14.0"
},
"require-dev": {
"laravel/pint": "^1.0",
Expand Down Expand Up @@ -81,4 +83,4 @@
},
"minimum-stability": "dev",
"prefer-stable": true
}
}
2 changes: 1 addition & 1 deletion config/jotform-sdk.php
Expand Up @@ -2,5 +2,5 @@

// config for ChrisReedIO/JotformSDK
return [

'api_key' => env('JOTFORM_API_KEY'),
];
2 changes: 1 addition & 1 deletion src/Facades/JotformSDK.php
Expand Up @@ -9,7 +9,7 @@
*/
class JotformSDK extends Facade
{
protected static function getFacadeAccessor()
protected static function getFacadeAccessor(): string
{
return \ChrisReedIO\JotformSDK\JotformSDK::class;
}
Expand Down
7 changes: 7 additions & 0 deletions src/JotformSDK.php
Expand Up @@ -2,6 +2,13 @@

namespace ChrisReedIO\JotformSDK;

use Illuminate\Support\Facades\App;
use JotForm;

class JotformSDK
{
public static function api(): JotForm
{
return App::make(JotForm::class);
}
}
16 changes: 12 additions & 4 deletions src/JotformSDKServiceProvider.php
Expand Up @@ -3,6 +3,7 @@
namespace ChrisReedIO\JotformSDK;

use ChrisReedIO\JotformSDK\Commands\JotformSDKCommand;
use JotForm;
use Spatie\LaravelPackageTools\Package;
use Spatie\LaravelPackageTools\PackageServiceProvider;

Expand All @@ -17,9 +18,16 @@ public function configurePackage(Package $package): void
*/
$package
->name('laravel-jotform-sdk')
->hasConfigFile()
->hasViews()
->hasMigration('create_laravel-jotform-sdk_table')
->hasCommand(JotformSDKCommand::class);
->hasConfigFile();
// ->hasViews()
// ->hasMigration('create_laravel-jotform-sdk_table')
// ->hasCommand(JotformSDKCommand::class);
}

public function packageRegistered(): void
{
$this->app->singleton(JotForm::class, function () {
return new Jotform(config('jotform-sdk.api_key'));
});
}
}

0 comments on commit 830dc55

Please sign in to comment.