Skip to content

Boilerplate for starting new a Packagist package generally used by Laravel and an API

License

Notifications You must be signed in to change notification settings

fintech-systems/packagist-boilerplate

Repository files navigation

Technology API

GitHub release (latest by date) Build Status GitHub

A Technology API designed to run standalone or part of a Laravel Application

Requirements:

  • PHP 8.0
  • Technology

Installation

You can install the package via composer:

composer require :vendor_slug/:package_slug

Usage

Framework Agnostic PHP

<?php

use VendorName\Api\Technology;

require 'vendor/autoload.php';

$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
$dotenv->load();

$server = [
    'api_url'        => $_ENV['TECHNOLOGY_API_URL'],
    'api_key'        => $_ENV['TECHNOLOGY_API_KEY'],
    'api_secret'     => $_ENV['TECHNOLOGY_API_SECRET'],
];

$api = new Technology($server);

$result = $api->getInformation();

Laravel Installation

You can publish the config file with:

php artisan vendor:publish --provider="VendorName\Skeleton\SkeletonServiceProvider" --tag=":package_slug-config"

Features

Feature 1

Framework Agnostic PHP:

$newRecord = ['test1', 'test2'];

$api = new Technology;
$api->post($test);

Laravel App:

$newRecord = ['test1', 'test2'];

Technology::post($newRecord);

Expected result:

A new record is added.

Testing

vendor/bin/phpunit

Use the command below to run tests that excludes touching the API:

vendor/bin/phpunit --exclude-group=live

The storage folder has examples API responses, also used for caching during tests.

Coverage reports

To regenerate coverage reports:

XDEBUG_MODE=coverage ./vendor/bin/phpunit --coverage-html=tests/coverage-report

See also .travis.yml

Local Editing

For local editing, add this to composer.json:

"repositories" : [
        {
            "type": "path",
            "url": "../technology-api"
        }
    ]

Then in require section:

"fintech-systems/technology-api": "dev-main",

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

Boilerplate for starting new a Packagist package generally used by Laravel and an API

Resources

License

Security policy

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published