Skip to content

Commit

Permalink
Merge pull request #4 from codeborne/master
Browse files Browse the repository at this point in the history
Use Composer's project structure
  • Loading branch information
cal6 authored Nov 17, 2016
2 parents b7a75d8 + d4fd49b commit 6a5386c
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 13 deletions.
34 changes: 28 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,49 @@
maksekeskus-php
===============

#Installation

## Composer

``` json
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/maksekeskus/maksekeskus-php"
}
],
"require": {
"maksekeskus/maksekeskus-php": "v1.1"
}
}
```

## Prebuilt packages

Download the packaged library form the repository [releases]
(https://github.com/maksekeskus/maksekeskus-php/releases/).

Unpack it into your project folder (i.e. /htdocs/myshop/ )
and include the libarary file ( i.e. /htdocs/myshop/Maksekeskus-1.0/Maksekeskus.php )
and include the libarary file ( i.e. /htdocs/myshop/Maksekeskus-1.1/Maksekeskus.php )

Get your API keys from [merchant.maksekeskus.ee](https://merchant.maksekeskus.ee) or [merchant-test.maksekeskus.ee](https://merchant-test.maksekeskus.ee)

And off you go:
# Example

``` php
<?php
include_once 'maksekeskus-1.0/Maksekeskus.php';

// get your API keys from merchant-test.maksekeskus.ee or merchant.maksekeskus.ee
require __DIR__ . '/maksekeskus-1.1/vendor/autoload.php'; //Comment this line out if you are using Composer to build your project

use Maksekeskus\Maksekeskus;

$shopId = '12ee0036-3719-...-9a8b-51f5770190ca';
$KeyPublishable = '5wCSE2B2OAV6...cpe2N1kZQzCXNTe';
$KeySecret = 'JvH2IZ6W6fvKB7W7...ea3BLWgqcfbhQKEN1w2UDrua3sWlojPGfhp';

// use TRUE if working against the Test environment
// use TRUE if working against the Test environment
// see https://makecommerce.net/en/for-developers/test-environment/
$MK = new Maksekeskus($shopId,$KeyPublishable,$KeySecret,TRUE);

Expand All @@ -33,8 +57,6 @@ print_r($data);
print "</pre>";

?>


```

See more examples on https://maksekeskus.ee/api-explorer/intro.php
Expand Down
5 changes: 3 additions & 2 deletions bin/createdist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ VERSION=$1
rm -rf maksekeskus-$VERSION

mkdir maksekeskus-$VERSION/
cp -rp lib/* maksekeskus-$VERSION/
cp -rp lib maksekeskus-$VERSION/
cp composer.json maksekeskus-$VERSION/

cd maksekeskus-$VERSION/
composer install
composer install --no-dev
rm composer.lock composer.json

cd ..
Expand Down
8 changes: 6 additions & 2 deletions lib/composer.json → composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{
"name": "maksekeskus/maksekeskus-php",
"description": "Maksekeskus PHP SDK",
"type": "library",
"keywords": [
"maksekeskus",
"billing",
Expand All @@ -23,6 +24,9 @@
"ext-json": "*"
},
"autoload": {
"classmap": [""]
}
"psr-4": {
"Maksekeskus\\": "lib/"
}
},
"minimum-stability": "dev"
}
5 changes: 2 additions & 3 deletions lib/Maksekeskus.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?php
namespace Maksekeskus;

// use the composer.json to install dependancies (https://getcomposer.org/)
// autoload the composer-installed classes
require __DIR__ . '/vendor/autoload.php';
use Exception;
use Httpful\Http;
use Httpful\Request;

Expand Down

0 comments on commit 6a5386c

Please sign in to comment.