Skip to content
This repository was archived by the owner on Jul 15, 2020. It is now read-only.

Commit 6e463de

Browse files
wip
1 parent 90f65b1 commit 6e463de

File tree

1 file changed

+52
-65
lines changed

1 file changed

+52
-65
lines changed

README.md

Lines changed: 52 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<p align="center">
2-
<img src="https://cloudinary-res.cloudinary.com/image/upload/c_scale,w_86/v1/logo/for_white_bg/cloudinary_vertical_logo_for_white_bg.png">
3-
Laravel Cloudinary
2+
<!-- <img src="https://cloudinary-res.cloudinary.com/image/upload/c_scale,w_86/v1/logo/for_white_bg/cloudinary_vertical_logo_for_white_bg.png"> -->
3+
<h3> Laravel Cloudinary </h3>
4+
<p>Laravel-Cloudinary is a package for easily uploading, optimizing, transforming and attaching media files to Eloquent models with Laravel.</p>
45
</p>
56

67
<p align="center">
@@ -18,9 +19,6 @@
1819
</a>
1920
</p>
2021

21-
22-
> A Laravel Package for working with Cloudinary seamlessly
23-
2422
## Installation
2523

2624
[PHP](https://php.net) 5.4+ or [HHVM](http://hhvm.com) 3.3+, and [Composer](https://getcomposer.org) are required.
@@ -34,26 +32,25 @@ composer require unicodeveloper/laravel-cloudinary
3432
Or add the following line to the require block of your `composer.json` file.
3533

3634
```
37-
"unicodeveloper/laravel-cloudinary": "1.0.*"
35+
"unicodeveloper/laravel-cloudinary": "1.0.0-beta"
3836
```
3937

4038
You'll then need to run `composer install` or `composer update` to download it and have the autoloader updated.
4139

4240

43-
44-
Once Laravel Paystack is installed, you need to register the service provider. Open up `config/app.php` and add the following to the `providers` key.
41+
Once Laravel Cloudinary is installed, you need to register the service provider. Open up `config/app.php` and add the following to the `providers` key.
4542

4643
```php
4744
'providers' => [
4845
...
49-
Unicodeveloper\Paystack\PaystackServiceProvider::class,
46+
Unicodeveloper\Cloudinary\CloudinaryServiceProvider::class,
5047
...
5148
]
5249
```
5350

5451
> If you use **Laravel >= 5.5** you can skip this step and go to [**`configuration`**](https://github.com/unicodeveloper/laravel-cloudinary#configuration)
5552
56-
* `Unicodeveloper\Paystack\PaystackServiceProvider::class`
53+
* `Unicodeveloper\Cloudinary\CloudinaryServiceProvider::class`
5754

5855
Also, register the Facade like so:
5956

@@ -73,73 +70,63 @@ You can publish the configuration file using this command:
7370
php artisan vendor:publish --provider="Unicodeveloper\Cloudinary\CloudinaryServiceProvider"
7471
```
7572

76-
A configuration-file named `paystack.php` with some sensible defaults will be placed in your `config` directory:
73+
A configuration-file named `cloudinary.php` with some sensible defaults will be placed in your `config` directory:
7774

7875
```php
7976
<?php
80-
8177
return [
82-
83-
/**
84-
* Public Key From Paystack Dashboard
85-
*
86-
*/
87-
'publicKey' => getenv('PAYSTACK_PUBLIC_KEY'),
88-
89-
/**
90-
* Secret Key From Paystack Dashboard
91-
*
92-
*/
93-
'secretKey' => getenv('PAYSTACK_SECRET_KEY'),
94-
95-
/**
96-
* Paystack Payment URL
97-
*
98-
*/
99-
'paymentUrl' => getenv('PAYSTACK_PAYMENT_URL'),
100-
101-
/**
102-
* Optional email address of the merchant
103-
*
104-
*/
105-
'merchantEmail' => getenv('MERCHANT_EMAIL'),
106-
78+
'notification_url' => env('CLOUDINARY_NOTIFICATION_URL', ''),
79+
80+
'account_details' => [
81+
82+
'account' => [
83+
/**
84+
* Cloud Name From Cloudinary Dashboard
85+
*
86+
*/
87+
'cloud_name' => env('CLOUDINARY_CLOUD_NAME'),
88+
89+
/**
90+
* API Key From Cloudinary Dashboard
91+
*
92+
*/
93+
'api_key' => env('CLOUDINARY_API_KEY'),
94+
95+
/**
96+
* API Secret From Cloudinary Dashboard
97+
*
98+
*/
99+
'api_secret' => env('CLOUDINARY_API_SECRET'),
100+
101+
/**
102+
* Upload Preset From Cloudinary Dashboard
103+
*
104+
*/
105+
'upload_preset' => env('CLOUDINARY_UPLOAD_PRESET')
106+
],
107+
108+
'url' => [
109+
'secure' => true
110+
]
111+
]
107112
];
108113
```
109114

110-
111-
## General payment flow
112-
113-
Though there are multiple ways to pay an order, most payment gateways expect you to follow the following flow in your checkout process:
114-
115-
### 1. The customer is redirected to the payment provider
116-
After the customer has gone through the checkout process and is ready to pay, the customer must be redirected to site of the payment provider.
117-
118-
The redirection is accomplished by submitting a form with some hidden fields. The form must send a POST request to the site of the payment provider. The hidden fields minimally specify the amount that must be paid, the order id and a hash.
119-
120-
The hash is calculated using the hidden form fields and a non-public secret. The hash used by the payment provider to verify if the request is valid.
121-
122-
123-
### 2. The customer pays on the site of the payment provider
124-
The customer arrives on the site of the payment provider and gets to choose a payment method. All steps necessary to pay the order are taken care of by the payment provider.
125-
126-
### 3. The customer gets redirected back to your site
127-
After having paid the order the customer is redirected back. In the redirection request to the shop-site some values are returned. The values are usually the order id, a paymentresult and a hash.
128-
129-
The hash is calculated out of some of the fields returned and a secret non-public value. This hash is used to verify if the request is valid and comes from the payment provider. It is paramount that this hash is thoroughly checked.
130-
131-
132115
## Usage
133116

134-
Open your .env file and add your public key, secret key, merchant email and payment url like so:
117+
Open your .env file and add your Cloudinary cloud name, api key, api secret, and upload preset like so:
135118

136119
```php
137-
PAYSTACK_PUBLIC_KEY=xxxxxxxxxxxxx
138-
PAYSTACK_SECRET_KEY=xxxxxxxxxxxxx
139-
PAYSTACK_PAYMENT_URL=https://api.paystack.co
140-
MERCHANT_EMAIL=unicodeveloper@gmail.com
120+
CLOUDINARY_CLOUD_NAME=xxxxxxxxxxxxx
121+
CLOUDINARY_API_KEY=xxxxxxxxxxxxx
122+
CLOUDINARY_API_SECRET=xxxxxxxxxxxxx
123+
CLOUDINARY_UPLOAD_PRESET=xxxxxxxxxxxxx
124+
CLOUDINARY_NOTIFICATION_URL=
141125
```
142-
*If you are using a hosting service like heroku, ensure to add the above details to your configuration variables.*
126+
127+
***Note:** You need to get these credentials from your [Cloudinary Dashboard](https://cloudinary.com/console)*
128+
129+
*If you are using a hosting service like heroku,forge,digital ocean, etc, please ensure to add the above details to your configuration variables.*
143130

144131
Set up routes and controller methods like so:
145132

0 commit comments

Comments
 (0)