Download the PHP package justbetter/laravel-magento-client without Composer

On this page you can find all versions of the php package justbetter/laravel-magento-client. 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-magento-client

Laravel Magento Client

Tests Coverage Analysis Total downloads

A client to communicate with Magento from your Laravel application.

Looking to synchronize prices or stock to Magento?

Installation

Are you coming from grayloon/laravel-magento-api? We have written a migration guide!

Require this package:

Configuration

Add the following to your .env:

Optionally, publish the configuration file of this package.

Multiple connections

This package supports connecting to multiple Magento instances. In the configuration file you will find an array with the connections where you can configure each connection.

The connection setting sets which connection is used by default. You can switch connections by using the connection method on the client.

Authentication

By default, this packages uses Bearer tokens to authenticate to Magento. Since Magento 2.4.4, this method of authentication requires additional configuration in Magento as described here.

It is recommended to authenticate to Magento using OAuth 1.0 which will also prevent the additional configuration requirements, besides setting up the integration itself.

Setting up OAuth 1.0

Start by adding the following variable to your .env-file.

Note that you can also remove MAGENTO_ACCESS_TOKEN at this point, as it will be saved in a file instead.

Next, open Magento and create a new integration. When configuring, supply a Callback URL and Identity link URL. If you have not made any changes to your configuration, these are the URLs:

connection is the key in your connections array in the configuration file.

When creating the integration, Magento will send multiple tokens and secrets to your application via the callback-endpoint. This information will be saved in the database, as configured in magento.php. You may adjust this to save the key in a JSON file or create your own implementation Magento will redirect you to the identity-endpoint in order to activate the integration.

For more information about OAuth 1.0 in Magento, please consult the documentation.

Identity endpoint

[!CAUTION] Be sure to add your authentication middleware

Note that the identity-endpoint does not have any authentication or authorization middleware by default - you should add this in the configuration yourself. If you do not have any form of protection, anyone could change the tokens in your secret file.

It is recommended that only administrators of your application are allowed to access the identity endpoint.

Usage

You can get an instance of the client by injecting it or by resolving it:

After you got an instance you can use the graphql, get, post, put and patch methods to use the Magento API.

SearchCriteria / Filtering

To easily create search criteria you can use the \JustBetter\MagentoClient\Query\SearchCriteria class. For example:

You can view more examples in Magento's documentation.

Connections

You can connect to other connections using the connection method on the client.

GraphQL

You can run authenticated GraphQL queries using the graphql method on the client.

More Examples

You can view the tests for more examples.

Testing

This package uses Laravel's HTTP client so that you can fake the requests.

Quality

To ensure the quality of this package, run the following command:

This will execute three tasks:

  1. Makes sure all tests are passed
  2. Checks for any issues using static code analysis
  3. Checks if the code is correctly formatted

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-magento-client with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
guzzlehttp/guzzle Version ^7.5
laravel/framework Version ^10.0|^11.0
league/oauth1-client Version ^1.10
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 justbetter/laravel-magento-client contains the following files

Loading the files please wait ....