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

Commit 1965a1e

Browse files
wip
1 parent 91eb120 commit 1965a1e

File tree

1 file changed

+30
-109
lines changed

1 file changed

+30
-109
lines changed

README.md

Lines changed: 30 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div align="center">
2-
<h2> Laravel Cloudinary </h2>
2+
<h1> Laravel Cloudinary </h1>
33
</div>
44

55
<p align="center">
@@ -17,138 +17,59 @@
1717
</a>
1818
</p>
1919

20-
> A Laravel Package for easily uploading, optimizing, transforming and delivering media files with Cloudinary. It provides a fluent and expressive API to easily attach your media files to Eloquent models.
20+
> A Laravel Package for uploading, optimizing, transforming and delivering media files with Cloudinary. It provides a fluent and expressive API to easily attach your media files to Eloquent models.
2121
2222

2323
## Usage
2424

25-
Upload a file to Cloudinary:
25+
Upload a file (Image, Video or any type of File) to Cloudinary:
2626

2727
```php
2828

29-
```
30-
31-
Let me explain the fluent methods this package provides a bit here.
32-
```php
33-
/**
34-
* This fluent method does all the dirty work of sending a POST request with the form data
35-
* to Paystack Api, then it gets the authorization Url and redirects the user to Paystack
36-
* Payment Page. We've abstracted all of it, so you don't have to worry about that.
37-
* Just eat your cookies while coding!
38-
*/
39-
Paystack::getAuthorizationUrl()->redirectNow();
40-
41-
/**
42-
* Alternatively, use the helper.
43-
*/
44-
paystack()->getAuthorizationUrl()->redirectNow();
45-
46-
/**
47-
* This fluent method does all the dirty work of verifying that the just concluded transaction was actually valid,
48-
* It verifies the transaction reference with Paystack Api and then grabs the data returned from Paystack.
49-
* In that data, we have a lot of good stuff, especially the `authorization_code` that you can save in your db
50-
* to allow for easy recurrent subscription.
51-
*/
52-
Paystack::getPaymentData();
53-
54-
/**
55-
* Alternatively, use the helper.
56-
*/
57-
paystack()->getPaymentData();
58-
5929
/**
60-
* This method gets all the customers that have performed transactions on your platform with Paystack
61-
* @returns array
62-
*/
63-
Paystack::getAllCustomers();
64-
65-
/**
66-
* Alternatively, use the helper.
67-
*/
68-
paystack()->getAllCustomers();
69-
70-
71-
/**
72-
* This method gets all the plans that you have registered on Paystack
73-
* @returns array
74-
*/
75-
Paystack::getAllPlans();
76-
77-
/**
78-
* Alternatively, use the helper.
79-
*/
80-
paystack()->getAllPlans();
30+
* Using the Cloudinary Facade
31+
*/
8132

33+
// Upload an Image File to Cloudinary with One line of Code
34+
$uploadedFileUrl = Cloudinary::upload($request->file('file')->getRealPath())->getSecurePath();
8235

83-
/**
84-
* This method gets all the transactions that have occurred
85-
* @returns array
86-
*/
87-
Paystack::getAllTransactions();
36+
// Upload an Video File to Cloudinary with One line of Code
37+
$uploadedFileUrl = Cloudinary::uploadVideo($request->file('file')->getRealPath())->getSecurePath();
8838

89-
/**
90-
* Alternatively, use the helper.
91-
*/
92-
paystack()->getAllTransactions();
39+
// Upload any File to Cloudinary with One line of Code
40+
$uploadedFileUrl = Cloudinary::uploadFile($request->file('file')->getRealPath())->getSecurePath();
9341

9442
/**
95-
* This method generates a unique super secure cryptograhical hash token to use as transaction reference
96-
* @returns string
43+
* This package also exposes a helper function you can use if you are not a fan of Facades
44+
* Shorter, expressive, fluent using the
45+
* cloudinary() function
9746
*/
98-
Paystack::genTranxRef();
9947

100-
/**
101-
* Alternatively, use the helper.
102-
*/
103-
paystack()->genTranxRef();
104-
105-
106-
/**
107-
* This method creates a subaccount to be used for split payments
108-
* @return array
109-
*/
110-
Paystack::createSubAccount();
111-
112-
/**
113-
* Alternatively, use the helper.
114-
*/
115-
paystack()->createSubAccount();
48+
// Upload an Image File to Cloudinary with One line of Code
49+
$uploadedFileUrl = cloudinary()->upload($request->file('file')->getRealPath())->getSecurePath();
11650

51+
// Upload an Video File to Cloudinary with One line of Code
52+
$uploadedFileUrl = cloudinary()->uploadVideo($request->file('file')->getRealPath())->getSecurePath();
11753

118-
/**
119-
* This method fetches the details of a subaccount
120-
* @return array
121-
*/
122-
Paystack::fetchSubAccount();
54+
// Upload any File to Cloudinary with One line of Code
55+
$uploadedFileUrl = cloudinary()->uploadFile($request->file('file')->getRealPath())->getSecurePath();
12356

12457
/**
125-
* Alternatively, use the helper.
58+
* You can also skip the Cloudinary Facade or helper method and laravel-ize your uploads by simply calling the
59+
* storeOnCloudinary() method on the file itself
12660
*/
127-
paystack()->fetchSubAccount();
12861

62+
// Store the uploaded file on Cloudinary
63+
$result = $request->file('file')->storeOnCloudinary();
12964

130-
/**
131-
* This method lists the subaccounts associated with your paystack account
132-
* @return array
133-
*/
134-
Paystack::listSubAccounts();
65+
// Store the uploaded file on Cloudinary
66+
$result = $request->file->storeOnCloudinary();
13567

136-
/**
137-
* Alternatively, use the helper.
138-
*/
139-
paystack()->listSubAccounts();
68+
// Store the uploaded file in the "lambogini" directory on Cloudinary
69+
$result = $request->file->storeOnCloudinary('lambogini');
14070

141-
142-
/**
143-
* This method Updates a subaccount to be used for split payments
144-
* @return array
145-
*/
146-
Paystack::updateSubAccount();
147-
148-
/**
149-
* Alternatively, use the helper.
150-
*/
151-
paystack()->updateSubAccount();
71+
// Store the uploaded file in the "lambogini" directory on Cloudinary with the filename "prosper"
72+
$result = $request->file->storeOnCloudinaryAs('lambogini', 'prosper');
15273
```
15374

15475
## Installation

0 commit comments

Comments
 (0)