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

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

Laravel Magento Stock

Tests Coverage Analysis Total downloads

This packages facilitates a way to push stock to Magento from a configurable source. Both simple stock and MSI are supported.

Features

This package provides all the logic of pushing stock to Magento. It only requires an implementation for retrieving the stock.

Features:

Also check out our other Laravel Magento packages! We also have a Magento Client to easily connect Laravel to Magento!

Installation

Require this package: composer require justbetter/laravel-magento-stock

Publish the config

Publish the activity log's migrations:

Run migrations.

TIP: All actions in this package are run via jobs, we recommend Laravel Horizon or another queueing system to run these

Add the following commands to your scheduler.

Laravel Nova

We have a Laravel Nova integration for this package.

Setup

This package requires you to implement a stock repository which is responsible for retrieving stock.

Retrieving stock

Implement the retrieve method and return a StockData object that contains the stock fields.

Retrieving SKU's

By default the Repository that you are extending will retrieve the SKU's from justbetter/laravel-magento-products. If you wish to use this you have to add the commands to your scheduler to automatically import products.

If you have another source for your SKU's you may implement the skus method yourself. It accepts an optional carbon instance to only retrieve modified stock.

Configuring the repository

The repository class has a couple of settings that you can adjust:

After you've created and configured the repository you have to set it in your configuration file:

Usage

To retrieve stock you can use the following commands.

Processing stocks that are marked for retrieval/update

php artisan magento-stock:process

Each stock record has two flags, retrieve and update. This command will dispatch the jobs to run those actions. It is primarily used for updates, but you can implement the retrieve flag in your application to slow down retrievals.

Retrieving stock for a single SKU

php artisan magento-stock:retrieve {sku}

This will directly pass the SKU to your repository and process the result. If the stock has been modified it will set the update flag.

Retrieving stock for all or modified SKU's

php artisan magento-stock:retrieve-all {from?}

This will call the skus method on your repository and dispatch retrieval jobs for all the SKU's that are returned from your repository.

Updating stock for a single SKU

php artisan magento-stock:update {sku}

Updating all stock

php artisan magento-stock:update-all

Comparing stock

php artisan magento-stock:compare

This will compare the stock in Magento and the database table. If it differs it will force an update to Magento.

Magento MSI

If you have Magento MSI enabled you have to return the quantity and status of each source in the repository.

NOTE: Be sure to set the msi setting in the repository to true!

For example:

Comparisons

This feature requires job batching

This package provides a way to compare stock quantities in Magento with those in the Laravel database. If a difference is detected it will start an update for that product.

An event is dispatched when a difference is detected \JustBetter\MagentoStock\Events\DifferenceDetectedEvent.

Handling failures

When an update fails it will try again. A fail counter is stored with the model which is increased at each failure. In the repository you can specify how many times the update may be attempted. You can restart the updates for a product by setting the sync field in the DB to true.

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-stock with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
justbetter/laravel-magento-async Version ^1.0
justbetter/laravel-magento-client Version ^2.6.1
justbetter/laravel-magento-products Version ^1.4
laravel/framework Version ^11.0|^12.0
spatie/laravel-activitylog Version ^4.7
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-stock contains the following files

Loading the files please wait ....