Skip to content

Commit

Permalink
Merge pull request #18 from php-lightning/install-symfony
Browse files Browse the repository at this point in the history
Use symfony controllers for the endpoint
  • Loading branch information
Chemaclass committed Apr 7, 2023
2 parents 756af13 + a5e0add commit e120fa9
Show file tree
Hide file tree
Showing 32 changed files with 3,783 additions and 2,424 deletions.
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,23 @@ vendor/
*.cache
composer.lock
lightning-config.php

###> symfony/framework-bundle ###
/.env.local
/.env.local.php
/.env.*.local
/config/secrets/prod/prod.decrypt.private.php
/public/bundles/
/var/
/vendor/
###< symfony/framework-bundle ###

###> friendsofphp/php-cs-fixer ###
/.php-cs-fixer.php
/.php-cs-fixer.cache
###< friendsofphp/php-cs-fixer ###

###> phpunit/phpunit ###
/phpunit.xml
.phpunit.result.cache
###< phpunit/phpunit ###
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,18 @@ The following need to be changed according to your `apiEndpoint` and `apiKey` th
```php
# lightning-config.php
return (new LightningConfig())
->setDomain('your-domain.com')
->setReceiver('custom-receiver')
->setDomain('localhost')
->setReceiver('default-receiver')
->setSendableRange(min: 100_000, max: 10_000_000_000)
->setCallbackUrl('https://your-domain.com/path/to/index.php')
->addBackend(
(new LnBitsBackendConfig())
->setApiEndpoint('http://localhost:5000') // lnbits endpoint : protocol://host:port
->setApiKey('3h9e75cf...9eca373'), // put your lnbits read key here
);
->setCallbackUrl('localhost:8000/callback')
->setBackends([
'user-1' => (new LnBitsBackendConfig())
->setApiEndpoint('http://localhost:5000')
->setApiKey('api_key-1'),
'user-2' => (new LnBitsBackendConfig())
->setApiEndpoint('http://localhost:5000')
->setApiKey('api_key-2')
]);
```

> **Please note that the `min` and `max` do not reflect the actual min/max sendable amount, it depends on the capacity
Expand Down
17 changes: 17 additions & 0 deletions bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env php
<?php

use PhpLightning\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;

if (!is_file(dirname(__DIR__).'/vendor/autoload_runtime.php')) {
throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".');
}

require_once dirname(__DIR__).'/vendor/autoload_runtime.php';

return function (array $context) {
$kernel = new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);

return new Application($kernel);
};
34 changes: 28 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
"name": "php-lightning/lnaddress",
"type": "library",
"require": {
"php": ">=8.0",
"gacela-project/gacela": "^1.1"
"php": ">=8.0.2",
"gacela-project/gacela": "^1.1",
"symfony/framework-bundle": "6.0.*",
"symfony/http-client": "^6.0",
"symfony/runtime": "6.0.*",
"symfony/yaml": "6.0.*"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.16",
Expand All @@ -13,6 +17,21 @@
"symfony/var-dumper": "^5.4",
"vimeo/psalm": "^5.9"
},
"config": {
"platform": {
"php": "8.0.2"
},
"allow-plugins": {
"composer/package-versions-deprecated": true,
"symfony/flex": true,
"symfony/runtime": true
},
"optimize-autoloader": true,
"preferred-install": {
"*": "dist"
},
"sort-packages": true
},
"autoload": {
"psr-4": {
"PhpLightning\\": "src/"
Expand Down Expand Up @@ -52,10 +71,13 @@
"csfix": "XDEBUG_MODE=off ./vendor/bin/php-cs-fixer fix",
"csrun": "XDEBUG_MODE=off ./vendor/bin/php-cs-fixer fix --dry-run"
},
"config": {
"preferred-install": "dist",
"platform": {
"php": "8.0.27"
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "6.0.*"
}
}
}

0 comments on commit e120fa9

Please sign in to comment.