Download the PHP package c975l/purchasecredits-bundle without Composer

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

PurchaseCreditsBundle

PurchaseCreditsBundle does the following:

This Bundle relies on the use of c975LPaymentBundle, Stripe and its PHP Library. So you MUST have a Stripe account.

It is also recomended to use this with a SSL certificat to reassure the user.

As the Terms of sales MUST be sent to the user with the Gift-Voucher, you MUST provide a Route or url for this PDF file. If you don't have such, you may consider using c975LSiteBundle for its pre-defined models and c975LPageEditBundle for its ability to create a PDF.

PurchaseCreditsBundle dedicated web page.

PurchaseCreditsBundle API documentation.

Bundle installation

Step 1: Download the Bundle

v3.x works with Symfony 4.x. Use v2.x for Symfony 3.x Use Composer to install the library

Step 2: Configure the Bundle

Check dependencies for their configuration:

c975LPurchaseCreditsBundle uses c975L/ConfigBundle to manage configuration parameters. Use the Route "/purchase-credits/config" with the proper user role to modify them.

Step 3: Enable the Routes

Then, enable the routes by adding them to the /config/routes.yaml file of your project:

Step 4: User entity

Your User entity MUST have a property credits with proper and getter and setter, plus a addCredits() one, notice the +=, this method is used to add and subtract credits:

Step 5: Create MySql tables

You can use php bin/console make:migration to create the migration file as documented in Symfony's Doctrine docs OR use Use /Resources/sql/purchase-credits.sql to create the table user_transactions. The DROP TABLE is commented to avoid dropping by mistake.

Step 6: Override templates

It is strongly recommended to use the Override Templates from Third-Party Bundles feature to integrate fully with your site.

For this, simply, create the following structure /templates/bundles/c975LPurchaseCreditsBundle/ in your app and then duplicate the file layout.html.twig in it, to override the existing Bundle file.

In layout.html.twig, it will mainly consist to extend your layout and define specific variables, i.e. :

How to use

All the process for purchase and payment is managed via the bundle. All you have to implement on your side is the use of credits. You can do so with the following code:

Routes

The different Routes (naming self-explanatory) available are:

Twig access

You can access user's credits in Twig via

Credits information

If you want to display information about credits to user, you can add, in your Twig template, the following code. It will display, on one line, the number of credits, a link to transactions, a link to purchase and a warning when credits are <= 0.

Transaction display

The display of the list of transactions is done via the bundle, but in case you want to link to a specific transaction, you can do so with the following:

Credits Div data for javascript use

If you want to insert a div containing the user's credits, to be used by javascript, you can do it via the Twig extension:

Then you can access it via

Have a look at it to see the properties covered.

If this project help you to reduce time to develop, you can sponsor me via the "Sponsor" button at the top :)


All versions of purchasecredits-bundle with dependencies

PHP Build Version
Package Version
Requires php Version *
c975l/config-bundle Version ^2
c975l/email-bundle Version ^4
c975l/includelibrary-bundle Version ^1
c975l/payment-bundle Version ^4
c975l/services-bundle Version ^1
c975l/toolbar-bundle Version ^1
doctrine/doctrine-bundle Version *
doctrine/orm Version *
knplabs/knp-paginator-bundle Version *
symfony/form Version *
symfony/security Version *
symfony/translation Version *
twig/intl-extra Version *
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 c975l/purchasecredits-bundle contains the following files

Loading the files please wait ....