survos/global-giving-bundle

global-giving-bundle Bundle

Fund package maintenance!
kbond

Installs: 15

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 3

Forks: 0

Open Issues: 0

Type:symfony-bundle

1.5.442 2024-12-15 17:32 UTC

This package is auto-updated.

Last update: 2024-12-15 17:32:18 UTC


README

A simple bundle that facilitates calling the Global Giving API from a Symfony application.

composer require survos/global-giving-bundle

Get an API key at https://www.globalgiving.org/dy/v2/user/api/ and add it to your .env.local

# .env.local
GLOBAL_GIVING_API_KEY=your-api-key

Calls

Inject the service and make the calls

    #[Route('/featured', name: 'app_list_featured_projects')]
    public function listFeatured(GlobalGivingService $globalGivingService): Response
    {
        $data = $globalGivingService->getFeaturedProjects();
        return $this->render('app/index.html.twig', [
            'projects' => $data['project']
        ]);
    }

Note: There are only a handful of calls available to the API now. I'm hoping to get an OpenAPI spec from GlobalGiving.org to make development of this bundle easier and more reliable.