Download the PHP package bozboz/checkout without Composer
On this page you can find all versions of the php package bozboz/checkout. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package checkout
Checkout
Define a series of interconnecting screens that plug together as part of a continuous process.
For examples of implementation look at these repos:
Setup
- Require the package in Composer, by running
composer require bozboz/checkout
-
Add the service provider in app/config/app.php
- Add the
Checkout
facade to the aliases array inin app/config/app.php
Usage
- Register a new checkout process using the Checkout facade in
app/Http/routes.php
- Set a repository on the facade with the
using
method. The repository must implement theBozboz\Ecommerce\Checkout\CheckoutableRepository
interface and its purpose is to fetch the checkoutable instance. The instance must implement the Checkoutable interface. (The orders package has a default implementation to fetch the order instance from the session,Bozboz\Ecommerce\Orders\OrderRepository
). - On the returned object, call
add
to add screens. The add method takes 4 parameters:- The URL the screen will respond to
- The Screen class to use (resolved out the IoC container)
- An optional additional label to identify the screen, primarily used in the progress bar
- Route parameters (uses, as, before, etc.)
e.g.:
The above example will register the following URLs:
GET /checkout
POST /checkout
GET /checkout/customer
POST /checkout/customer
GET /checkout/address
POST /checkout/address
GET /checkout/delivery
POST /checkout/delivery
GET /checkout/billing
POST /checkout/billing
GET /checkout/complete
POST /checkout/complete
Screens
Screens must extend Bozboz\Ecommerce\Checkout\Screen
and must define a view() method.
Additionally, a canSkip
method is supported, which must return a boolean. If this method returns true
, the screen will be skipped in the process.
Processing the screen
To define a processing action (hit when the screen URL is POSTed to) the screen class must implement Bozboz\Ecommerce\Checkout\Processable
. This interface requires a process()
method be defined.
Providing this method does not throw an instance of Bozboz\Ecommerce\Checkout\ValidationException
, the checkout process will progress to the next screen upon completion.
Troubleshooting
When using test payments, if you get a 500 Internal Server Error upon clicking 'Take my money', try excluding the checkout/billing route from csrf protection.
In App\Http\Middleware\VerifyCsrfToken, add
All versions of checkout with dependencies
illuminate/session Version 5.2.*
illuminate/support Version 5.2.*