This project provides PHP sample implementations that show how to integrate our payment gateway into custom built websites.
The following implementations are provided
- vanilla-app: a simple stand-alone PHP implementation
- laravel-app: a basic Laravel implementation
The vanilla-app
uses our simple PHP client library (yoco/yoco-php), while the laravel-app
uses a wrapper for the client library (yoco/yoco-php-laravel). Both libraries are available as composer packages.
Running the samples below will show demos for the inline and popup card forms.
Inline Form | Popup Form |
---|---|
On the right-hand side of the screen we provide a panel with test credit card details, the currently configured API keys, and an activity monitor for logging out debug information.
To run the stand-alone PHP implementation, clone this repository, run composer install, and run the built-in PHP server as follows:
git clone https://github.com/YocoOpen/yoco-web-sdk-sample-php.git
cd yoco-web-sdk-sample-php/vanilla-app
composer install
php -S localhost:8000
Now visit http://localhost:8000 in your browser and try out the demos!
By default, the implementation uses our documentation's global test keys. These keys can be changed by editing the values in
lib/config.php
.
Here is a description of the main files in the vanilla-app
:
yoco/demo/chooser/index.php
: the landing pageyoco/demo/inline/index.php
: the inline payment formyoco/demo/popup/index.php
: the popup payment formyoco/charge/index.php
: handles the back-end charge call
To run the Laravel implementation, clone this repository, run composer install, setup the environment, and use artisan
to run the internal PHP server:
git clone https://github.com/YocoOpen/yoco-web-sdk-sample-php.git
cd yoco-web-sdk-sample-php/laravel-app
composer install
cp .env.example .env
php artisan key:generate
php artisan serve
Now visit http://localhost:8000 in your browser and try out the demos!
By default, the implementation uses our documentation's global test keys. These keys can be changed by editing the values in
config/yoco.php
.
Here is a description of the main files in the laravel-app
:
resources/views/yoco/demo/chooser.blade.php
: the landing pageresources/views/yoco/demo/inline.blade.php
: the inline payment formresources/views/yoco/demo/popup.blade.php
: the popup payment formapp/Http/Controllers/ChargeController.php
: handles the back-end charge call
The client libraries used in these implementations have their own documentation, which can be found at: