ergosarapu/donation-bundle

Donation Bundle allows creating developer friendly donation websites easily

Installs: 46

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:symfony-bundle

0.1.0 2024-09-13 10:58 UTC

This package is auto-updated.

Last update: 2024-12-03 09:22:16 UTC


README

Donation Bundle allows creating Symfony based donation websites easily

Installation

Open a command console, enter your project directory and execute:

composer require ergosarapu/donation-bundle

To initialize database, first generate migrations files ...

bin/console doctrine:migrations:diff

... then run migrations to create database tables:

bin/console doctrine:migrations:migrate

Register bundle routes:

// config/routes.yaml

donation_bundle_routes:
    # loads routes from the given routing file stored in bundle
    resource: '@DonationBundle/config/routes.xml'

# Define or override your routes here

donation_bundle_routes_campaign:
    # loads rest of loosely matching routes as last so they will not match before the ones defined before
    resource: '@DonationBundle/config/routes_campaign.xml'

Create admin user:

php bin/console donation:add-user [email] [givenname] [familyname] --admin

If you run your app in localhost, then the admin panel can be accessed at http://localhost/admin.

Register Payum gateway factories

The bundle uses Payum for payment gateway abstraction. In order to use a gateway, register Payum gateway factory, e.g:

// config/services.yaml

app.montonio_gateway_factory:
    class: Payum\Core\Bridge\Symfony\Builder\GatewayFactoryBuilder
    arguments: [ErgoSarapu\PayumMontonio\MontonioGatewayFactory]
    tags:
        - { name: payum.gateway_factory_builder, factory: montonio }

Then configure PayumBundle and gateways.

Configuration

The following configuration options are available for the Donation Bundle:

# config/packages/donation.yaml

donation:

    # Payments configuration.
    payments:
        onetime:
            bank:

                # Prototype
                country_code:
                    gateways:

                        # Prototype: Name of a Payum gateway
                        name:

                            # Payment method label as shown to the end user
                            label:                ~ # Required

                            # Payment method icon shown to the end user
                            image:                ~
            card:
                gateways:

                    # Prototype: Name of a Payum gateway
                    name:

                        # Payment method label as shown to the end user
                        label:                ~ # Required

                        # Payment method icon shown to the end user
                        image:                ~
        monthly:
            bank:

                # Prototype
                country_code:
                    gateways:

                        # Prototype: Name of a Payum gateway
                        name:

                            # Payment method label as shown to the end user
                            label:                ~ # Required

                            # Payment method icon shown to the end user
                            image:                ~
            card:
                gateways:

                    # Prototype: Name of a Payum gateway
                    name:

                        # Payment method label as shown to the end user
                        label:                ~ # Required

                        # Payment method icon shown to the end user
                        image:                ~

Reset password feature

The password reset feature uses SymfonyCastsResetPasswordBundle, check its configuration to modify its behavior.

In order to use reset password feature, install Mailer component in your application and configure sender globally:

# config/packages/mailer.yaml

mailer:
    envelope:
        sender: 'donations@example.com'
    headers:
        From: 'Donations <donations@example.com>'

Development

Set up dev environment using DDEV

ddev start

Install dependencies

To restrict packages install to specific Symfony version, install symfony/flex globally and specify your desired Symfony version:

composer global config --no-plugins allow-plugins.symfony/flex true
composer global require --no-interaction --no-progress symfony/flex:^2.4
composer config extra.symfony.require "7.1"

Testing

Use following script to run database migrations and tests:

./run_tests.sh

Set up app integrated dev environment

TODO: Describe how to set up dev environment with Symfony app using this bundle. While it is possible to develop bundle without setting up app itself, it is useful to verify things work properly as expected.