Download the PHP package lemaur/laravel-pinterest-api without Composer

On this page you can find all versions of the php package lemaur/laravel-pinterest-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-pinterest-api

Laravel Pinterest Api

Latest Version on Packagist Total Downloads License Tests GitHub Sponsors Trees

An Object-Oriented wrapper for consuming Pinterest API with Laravel.

It uses Pinterest API v5.


Warning: This package DOESN'T store Pinterest's credentials, you should provide your own logic!
👉 Please read carefully the Manage credentials section! 👈


Support Me

Hey folks,

Do you like this package? Do you find it useful, and it fits well in your project?

I am glad to help you, and I would be so grateful if you considered supporting my work.

You can even choose 😃:


Roadmap

This package still in development.
You can vote for endpoints not yet covered by requesting them here.
If so, it would be great if you wanted sponsor me to support my work.


Installation

You can require the package via composer:

You can install it with:


Manage credentials

Pinterest API Authentication follows the OAuth2 standard.

The package contains helpful methods to obtain the credentials from Pinterest OAuth server, but where to store them is up to you! Every project is different, with different requirements. You can store credentials on disk, or you can write them on DB and so on...

Note: You'll need to register a new app on Pinterest and get the app ID and secret key.
But don't worry, we'll do it in the next section.

Here I'll show you how to configure your project to manage credentials.

The authentication flow returns an object containing access_token and refresh_token within the expiration timestamps and other information.

Here an example:

The package emits Lemaur\Pinterest\Events\CredentialsRetrieved::class event within Lemaur\Pinterest\Data\OAuthData object when it receives the credentials. You can listen for this event in your project and store the credentials where you want.

To do that, you need to create a new listener

And inside the handle method you can decide where to store the credentials.

Don't forget to register the listener in the App\Providers\EventServiceProvider.

Now it's time to edit the service provider. Open App\Providers\PinterestServiceProvider, and inside the register method you will find a predefined implementation.

As you can see in the @TODO comment, here is where you should pass the credentials you previously stored.

In the previous examples we stored the credentials in the user's table.
So here, we can fetch them from the authenticated user.


Require Pinterest Access

Register and get your app ID and secret key

Note: internally app ID is client_id, internally secret key is client_secret!

  1. Log into www.pinterest.com; open a new tab with the account that you’ll use to manage your apps.
  2. Go to My Apps.
  3. Select Connect app and complete the request form with your app information.
  4. Submit your request to get trial access.
  5. As soon as Pinterest completes the review, Pinterest will notify you by email.
  6. Once you have received the email approval, go to My Apps to see your app ID and secret key.

It's now time to copy/paste the app ID and secret key to the .env file.

Configure the redirect URI

The package provides a default redirect URI /pinterest/callack. You are free to change it in your configuration file.

  1. Back to your Pinterest account.
  2. Go to My Apps and select your app.
  3. Go to Configure and, in Redirect URIs, enter the desired URI and save.

Note: For local development it's preferred to use http://localhost/pinterest/callback

Generate an access token

  1. To start the OAuth flow and request user access run php artisan pinterest:get-access-code-link
  2. Copy/Paste the link to your browser and follow the instructions on screen.
  3. At the end of the process you will see a white page with a text saying "All good! You can close this page."

Now you are ready to call the Pinterest API.


NOTES

Pinterest provides an access_token valid for 30 days and a refresh_token valid for 1 year.
The package automatically retrieves a new access token every time it expires, as long as the refresh token is still valid.
After 1 year, when you try to call an API endpoint, the package will throw a OAuthException with a message informing you to request a new access code.

If you are curious you can read the codebase to learn more.

Or you can use Lemaur\Pinterest\Facades\Pinterest::oauth()->credentials()->accessTokenExpiresIn to get the number of days before the access token will expire.
The same for the refresh token Lemaur\Pinterest\Facades\Pinterest::oauth()->credentials()->refreshTokenExpiresIn.


Testing

The package offers a nifty fake method to help you write your tests.
If you want some examples, I suggest to look at the package test suite.


Changelog

Please see CHANGELOG for more information on what has changed recently.


Contributing

Please see CONTRIBUTING for details.


Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.


Credits


License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-pinterest-api with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
guzzlehttp/guzzle Version ^7.5
illuminate/contracts Version ^9.0|^10.0
spatie/laravel-package-tools Version ^1.14.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package lemaur/laravel-pinterest-api contains the following files

Loading the files please wait ....