Download the PHP package darkorsa/shop without Composer

On this page you can find all versions of the php package darkorsa/shop. 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 shop

shop

Latest Version on Packagist Build Status Coverage Status Quality Score Total Downloads

This library is a convenient to use implementation of the shopping cart with the following features:

Also you do not have to worry about the correctness of operations on the amounts of money, this is carried out with the help of the Money for PHP library which is the implementation of the Money pattern by Martin Fowler.

This package is PSR-2 and PSR-4 compliant.

Install

Via Composer

Usage

A few steps are required to create a cart object.

Products

Products represent the goods sold in the shop. The required parameters are:

optional params:

If you need to include additional product data in your shopping cart, you can extend Product functionality by using the decorator pattern.

Cart items

Cart items represent the content of the shopping cart. Items can be injected into Cart object one by one or with use of collection.

To ensure that the amount of products in the cart is not greater than the amount in stock, a validator can be used.

Validation also takes place when you add an item to the Cart. When the same item is added again (i.e. an item with the same product ID), the item is not added twice, but it's quantity is incremented.

Shipping

Shipping can be defined so the shipping data will be available within the Cart object.

Payment

Payment can be defined in order to calculate payment fee. There are two methods of fee calculation. Fixed price and percentage.

Cart

Cart is an object representing a shopping cart and provides all the necessary methods to manage it or obtain calculated data.

Creation

Currency must be in ISO standard.

Usage

Note that all prices are represented as Money object.

Discounts

Discount can be applied to the Cart object. This library comes with 2 predefined discounts, however custom discounts can be applied as well.

Discount example:

Presenation

By default the prices are returned as Money object but one can easly format all the prices within Cart with use of CartPresenter.

Default formatter

Default formatter is Decimal Formatter.

Other formatters

One can use other formatters shipped with Money for PHP library or write own custom formmatter.

Cart data

To obtain all the cart data like prices, items, products, shipping details, payment, etc. toArray method can be used.

This data can then be passed on to the presentation layers or as an API response.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

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


All versions of shop with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4.0
moneyphp/money Version ^3.2 | ^4.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 darkorsa/shop contains the following files

Loading the files please wait ....