Register aws/laravel/sdk in lumen microframwork - lumen

I am trying to use the laravel/aws/sdk with lumen all the docs use
a config file which are not used in lumen. How do you register this
sdk in lumen?

Related

How to run vuejs backend postgres api?

We have a server and desktop computers on the same network. I am building a business application and have not found a way to directly work with Postgresql from vuejs. I have found that I can go through an API to work with Postgresql. I have built the API and it is in its own folder within the vuejs app and I run nodemon to start. I can make a production vuejs app but ...
How do I use the API in production?
How do I have the API autostart?
Thanks
I found a node module called node-windows. And this video about node-windows: https://www.youtube.com/watch?v=1smy9yyme1Y
I moved my backend API folder to my server and followed the video to add the node module and script to my server.
The module will autostart the service.

How to use Laravel's 5.6 native Auth functionality with MongoDB

I am using the first-time laravel, and want to use the laravel Auth for login and registration, MongoDB as backend. Using this command enables the laravel Auth
php artisan make:auth
will it work ? can anyone help me, how to do it..
php artisan make:auth
will just generate views since Laravel already comes with an Authentication feature so you don't have to build on scratch.
Now it is possible to have MongoDB as backend but it requires you to install a wrapper in order for Laravel to connect to your database.
I recommend using this one.
It requires PHP MongoDB extension to be installed in order for the package to fully work.

How to integrate an API Connect API as a BFF into a Bluemix mobile project?

Trying to use an API Connect generated app as the backend for my mobile project adding an OPENAPI_SPEC env variable as defined here:
https://console.ng.bluemix.net/docs/mobile/sdk_compute.html#definition
I can add the app as a compute instance in the Mobile Project UI but it can't generate the SDK, I guess it is because when published via APIC Editor to Bluemix the Loopback app isn't accessed directly but through the APIC gateway.
Any suggestion here?
I would presume that although you have an OPENAPI_SPEC environment variable, your Open API swagger doc isn't valid.
When you download the project, it will auto-generate an SDK corresponding with your backend's Open API document.
For instance, here is how you set the environment variable with an example relative path:
And here is a valid API doc that it's using (albeit not in the most elegant Open API compliant format yet but it works).
https://updatesdk.mybluemix.net/explorer/swagger.json
A good way to test the validity of your OPEN API swagger doc is using the new Bluemix SDK Gen CLI Plugin.
$ bx sdk validate
NAME:
validate - Determines if an OpenAPI specification is valid for SDK generation
USAGE:
bluemix sdk validate OPENAPI_DOC_LOCATION | APP_NAME
OPENAPI_DOC_LOCATION - is a raw OpenAPI specification (URL to spec or local file; json or yaml)
APP_NAME - is the name of an app running in your current space hosting
OpenAPI spec.
In addition, IBM provides a deployable BFF starter sample with an accompanying blog post which may be helpful.

Integrate Paypal PHP sdk with Cakephp 3.x

To use Paypal PHP SDK is quite simple but when i try to use this SDK in cakephp 3.x then it generates errors. I changed namespace name in "Paypal SDK project" to bring all files under one name space.
My cakephp project namespace name is
namespace App
but namespace in Paypal SDK is
namespace PayPal
I just changed it to "namespace App" and put all files in PayPal folder and put that folder in "src" folder in cakephp project. but PayPal does not work using this technique.
Can you please advise me how to use this SDK in CakePHP or where to put files are best.
I know there are some other techniques to make payment via paypal without SDK but i want to use SDK.
Can you please guide me little bit how to integrate PayPal PHP SDK in CakePHP.
SDK is provided here
https://github.com/paypal/PayPal-PHP-SDK
some payment samples are here
http://paypal.github.io/PayPal-PHP-SDK/sample/
1. Use composer for installation which will manages the dependencies:
Go to your project directory (Eg:E:\xampp\htdocs\cakephp) in command promot and type following:
composer require "paypal/rest-api-sdk-php:*"
This will install latest version of paypal sdk into the vendor folder,you can go into vendor and check that.
2. Configure your environment:
Make any function for configuration of paypal in any controller you would like:
public function configuration() {
$apiContext = new \PayPal\Rest\ApiContext(
new \PayPal\Auth\OAuthTokenCredential(
'YOUR APPLICATION CLIENT ID', // you will get information about client id and secret once you have created test account in paypal sandbox
'YOUR APPLICATION CLIENT SECRET'
)
);
}
As you are using cakephp framework you don't need to write following line into your function as suggested in papal documentation:
// Autoload SDK package for composer based installations
require 'vendor/autoload.php';
This is because you have already done that with autoload.php file within your vendor folder.
3. Using paypal classes:
You need to use paypal classes/namespace within your controller in this way:
namespace App\Controller; // your controller have this already
use App\Controller\AppController; // your controller have this already
use PayPal\Api\Payer;
use PayPal\Api\Item;
use PayPal\Api\ItemList;
4. Completely follow this quick start guide which will be pretty straight forward now:
Paypal quick start guide.
For making sandbox test accounts:(Paypal developer guide)
I recommend using : omnipay
https://packagist.org/packages/omnipay/paypal
or this add to your composer.json
{
"require": {
"omnipay/paypal": "~2.0"
}
then
$ curl -s http://getcomposer.org/installer | php
$ php composer.phar update
if windows
composer update

How to connect to mysql on a BlueMix PHP app

What directive do I need to include to have the mysqli library available to my php app on BlueMix?
You need to add the following to your composer.json file:
"require": {
"ext-mysqli": "*"
}
I suggest you to take also a look at this sample.