2017 © Pedro Peláez
 

library zf2-tip-me

ZF2 module for accepting tips/donations with Stripe

image

cgm/zf2-tip-me

ZF2 module for accepting tips/donations with Stripe

  • Sunday, January 17, 2016
  • by cgmartin
  • Repository
  • 1 Watchers
  • 6 Stars
  • 32 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

ZF2TipMe

No Maintenance Intended, (*1)

Version 1.0.0 / Created by Christopher Martin / BSD-3-Clause License, (*2)

Introduction

Accept donations directly on your site with Zend Framework 2 and a free Stripe account., (*3)

ZF2TipMe example screenshot, (*4)

Features

  • Notification emails can be sent after successful payments.
  • Test mode toggle, with a list of test credit cards for various testing scenarios.
  • Designed for easy customization. Donation items are configurable. Event hooks available.
  • Failed transactions are logged.
  • No PCI data is sent to or stored on your server, thanks to Stripe.

Stripe currently is only available in United States and Canada., (*5)

Get notified of when Stripe is available in your country., (*6)

Installation

Composer / Packagist Install

Add "minimum-stability": "dev" to your composer.json file, and run:, (*7)

# From project's base directory...
% composer.phar require cgm/zf2-tip-me
Please provide a version constraint for the cgm/config-admin requirement: dev-master

Enable the ZF2TipMe Module

Edit your application.config.php and enable the ZfcBase and ZF2TipMe modules:, (*8)

return array(
    'modules' => array(
        // ...
        'ZfcBase',
        'ZF2TipMe',
    ),
    // ...
);

Out of the box, this module is configured to write log files to ./data/log and ./data/mail. The mail logs are used when you have chosen not to use a mail server., (*9)

# From project's base directory...
% cd data
% mkdir log mail
% chmod 777 log mail
# Or set the appropriate group permissions to be writable by the webserver

There is an asset folder with CSS and JavaScript files. You can link them to ./public/tip-me-assets, or potentially use a asset management module:, (*10)

# From the project's base dir...
% cd public
% ln -s ../vendor/cgm/zf2-tip-me/public tip-me-assets

Edit the Configuration

Copy the .global and .local dist files from the module config directory:, (*11)

# From project's base directory...
% cd config/autoload
% cp ../../vendor/cgm/zf2-tip-me/config/zf2tipme.global.php.dist ./zf2tipme.global.php
% cp ../../vendor/cgm/zf2-tip-me/config/zf2tipme.local.php.dist ./zf2tipme.local.php

Edit the zf2tipme.global.php file to taste:, (*12)

<?php
return array(
    'zf2tipme' => array(
        'error_log'            => './data/log/tipme.log',
        'recipient_name'       => '{{{RECIPIENT}}}',            // Your name
        'admin_email'          => '{{{admin@email.address}}}',  // Displayed for refunds, and used for mail notifications
        'statement_descriptor' => '{{{STATEMENT_DESCRIPTOR}}}', // Stripe account setting
        'tip_options' => array(                                 // Customize away...
            'coffee' => array(
                'title'   => 'Cup of Starbucks coffee (12 oz)',
                'amount'  => 2.50,
                'img_src' => 'http://placehold.it/200x150',
            ),
            'redbull' => array(
                'title'  => 'Red Bull (20 oz, sugar free)',
                'amount' => 4.48,
                'img_src' => 'http://placehold.it/200x150',
            ),
            'music' => array(
                'title'  => 'MP3 music (album)',
                'amount' => 9.99,
                'img_src' => 'http://placehold.it/200x150',
            ),
        ),
        'mail_transport_options' => array(                       // Used with default 'zf2tipme_mailtransport' factory in Module.php
            'path' => './data/mail/',
        ),
    ),
);

Edit the zf2tipme.local.php file with your Stripe API keys:, (*13)

<?php
$testMode = true;
return array(
    'zf2tipme' => array(
        'test_mode'          => $testMode,
        'stripe_secret_key'  => ($testMode)
                              ? '{{{TEST_SECRET_KEY_HERE}}}'
                              : '{{{LIVE_SECRET_KEY_HERE}}}',
        'stripe_publish_key' => ($testMode)
                              ? '{{{TEST_PUBLISHABLE_KEY_HERE}}}'
                              : '{{{LIVE_PUBLISHABLE_KEY_HERE}}}',
    ),
);

Verify it works

Point your browser to /tip-me and use the "Fill Test Data" dropdown for testable credit cards., (*14)

Like this module?

Tip me a coffee :coffee: ;), (*15)

The Versions

17/01 2016

dev-master

9999999-dev https://github.com/cgmartin/ZF2TipMe

ZF2 module for accepting tips/donations with Stripe

  Sources   Download

BSD-3-Clause

The Requires

 

zf2 zend module tips