Skip to content

Commit 86a53ec

Browse files
committed
Update README.md
update readme with markdown codeblock syntax and typehinting aswell as making it non Laravel 5 specific.
1 parent 6da6494 commit 86a53ec

File tree

1 file changed

+45
-31
lines changed

1 file changed

+45
-31
lines changed

readme.md

Lines changed: 45 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,70 @@
1-
## Omnipay for Laravel 5
1+
## Omnipay for Laravel
22

33
This is a package to integrate [Omnipay](https://github.com/omnipay/omnipay) with Laravel.
44
You can use it to easily manage your configuration, and use the Facade to provide shortcuts to your gateway.
55

66
## Installation
77

8-
Require this package in your composer.json and run composer update (or run `composer require barryvdh/laravel-omnipay:0.3.x` directly):
9-
10-
"barryvdh/laravel-omnipay": "0.3.*@dev"
8+
Require this package in your composer.json and run composer update (or run `composer require barryvdh/laravel-omnipay` directly):
119

10+
```php
11+
"barryvdh/laravel-omnipay": "0.3.*"
12+
```
13+
1214
Pre Laravel 5.5: After updating composer, add the ServiceProvider to the providers array in config/app.php
1315

14-
'Barryvdh\Omnipay\ServiceProvider',
16+
```php
17+
'Barryvdh\Omnipay\ServiceProvider',
18+
```
1519

1620
You need to publish the config for this package. A sample configuration is provided. The defaults will be merged with gateway specific configuration.
1721

18-
$ php artisan vendor:publish --provider='Barryvdh\Omnipay\ServiceProvider'
22+
```
23+
$ php artisan vendor:publish --provider='Barryvdh\Omnipay\ServiceProvider'
24+
```
1925

2026
To use the Facade (`Omnipay::purchase()` instead of `App::make(`omnipay`)->purchase()`), add that to the facades array.
2127

22-
'Omnipay' => 'Barryvdh\Omnipay\Facade',
28+
```php
29+
'Omnipay' => 'Barryvdh\Omnipay\Facade',
30+
```
2331

2432
When calling the Omnipay facade/instance, it will create the default gateway, based on the configuration.
2533
You can change the default gateway by calling `Omnipay::setDefaultGateway('My\Gateway')`.
2634
You can get a different gateway by calling `Omnipay::gateway('My\Cass')`
2735

2836
## Examples
2937

30-
$params = [
31-
'amount' => $order->amount,
32-
'issuer' => $issuerId,
33-
'description' => $order->description,
34-
'returnUrl' => URL::action('PurchaseController@return', [$order->id]),
35-
];
36-
$response = Omnipay::purchase($params)->send();
37-
38-
if ($response->isSuccessful()) {
39-
// payment was successful: update database
40-
print_r($response);
41-
} elseif ($response->isRedirect()) {
42-
// redirect to offsite payment gateway
43-
return $response->getRedirectResponse();
44-
} else {
45-
// payment failed: display message to customer
46-
echo $response->getMessage();
47-
}
38+
```php
39+
$params = [
40+
'amount' => $order->amount,
41+
'issuer' => $issuerId,
42+
'description' => $order->description,
43+
'returnUrl' => URL::action('PurchaseController@return', [$order->id]),
44+
];
45+
46+
$response = Omnipay::purchase($params)->send();
47+
48+
if ($response->isSuccessful()) {
49+
// payment was successful: update database
50+
print_r($response);
51+
} elseif ($response->isRedirect()) {
52+
// redirect to offsite payment gateway
53+
return $response->getRedirectResponse();
54+
} else {
55+
// payment failed: display message to customer
56+
echo $response->getMessage();
57+
}
58+
```
4859

4960
Besides the gateway calls, there is also a shortcut for the creditcard:
5061

51-
$formInputData = array(
52-
'firstName' => 'Bobby',
53-
'lastName' => 'Tables',
54-
'number' => '4111111111111111',
55-
);
56-
$card = Omnipay::CreditCard($formInputData);
62+
```php
63+
$formInputData = [
64+
'firstName' => 'Bobby',
65+
'lastName' => 'Tables',
66+
'number' => '4111111111111111',
67+
];
68+
69+
$card = Omnipay::CreditCard($formInputData);
70+
```

0 commit comments

Comments
 (0)