Skip to content

Instantly share code, notes, and snippets.

View apoca's full-sized avatar
🚀
Working hard with microservices infrastructure

Miguel Vieira apoca

🚀
Working hard with microservices infrastructure
View GitHub Profile
@apoca
apoca / gist:9069327
Created February 18, 2014 11:35
Paypal sdk
use PayPal\Service\AdaptivePaymentsService;
use PayPal\Types\AP\Receiver;
use PayPal\Types\AP\ReceiverList;
use PayPal\Types\AP\PayRequest;
use PayPal\Types\Common\RequestEnvelope;
use PayPal\Service\AdaptiveAccountsService;
use PayPal\Types\AA\AccountIdentifierType;
use PayPal\Types\AA\GetVerifiedStatusRequest;
public function getControllerPluginConfig()
{
return array(
'factories' => array(
// call this key zmPlugin in your action controller
'emailsPlugin' => function ($sm)
{
$emailPluginController = new \Application\Controller\Plugin\EmailsPluginController();
$emailPluginController->setServiceManager($sm);
return $emailPluginController;
My controller Login:
public function authenticateAction()
{
$request = $this->getRequest();
if ($request->isPost()){
$params = $request->getPost()->toArray();
//check authentication...
$username = $request->getPost('npo-login-email');
ERROR:
Fatal error: Uncaught exception 'Zend\ServiceManager\Exception\ServiceNotFoundException' with message 'ZfcRbac\Role\RoleProviderPluginManager::get was unable to fetch or create an instance for ' in /Applications/MAMP/htdocs/RadiusCheck/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php:529 Stack trace: #0 /Applications/MAMP/htdocs/RadiusCheck/vendor/zendframework/zendframework/library/Zend/ServiceManager/AbstractPluginManager.php(103): Zend\ServiceManager\ServiceManager->get(NULL, true) #1 /Applications/MAMP/htdocs/RadiusCheck/vendor/zf-commons/zfc-rbac/src/ZfcRbac/Factory/RoleServiceFactory.php(51): Zend\ServiceManager\AbstractPluginManager->get(NULL, false) #2 [internal function]: ZfcRbac\Factory\RoleServiceFactory->createService(Object(Zend\ServiceManager\ServiceManager), 'zfcrbacservicer...', 'ZfcRbac\Service...') #3 /Applications/MAMP/htdocs/RadiusCheck/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php(902): call_user_func(Array, Obj
var http = require('http');
var https = require('https');
var fs = require('fs');
var socket = require('socket.io');
var express = require('express');
var app = express();
var port = 3000;
var server = https.createServer(sslOptions, app).listen(port, function(){
'asset_manager' => array(
'caching' => array(
'default' => array(
'cache' => 'Assetic\\Cache\\FilesystemCache',
'options' => array(
'dir' => 'public/cache'
)
)
),
'resolver_configs' => array(
<?xml version="1.0" encoding="UTF-8" ?>
<project name="PHP_CodeCoverage">
<target name="clean" description="Cleanup build artifacts">
<delete dir="${basedir}/vendor" />
<delete file="${basedir}/composer.lock" />
</target>
<target name="composer" depends="clean" description="Install dependencies with Composer">
<tstamp>
<format property="thirty.days.ago" pattern="MM/dd/yyyy hh:mm aa" offset="-30" unit="day" />
$http = new Client([
'base_uri' => 'http://esolidar-api',
]);
// print_r($http);
$request = $http->post('/users/auth', [
'json' => [
'username' => 'vieira@miguelvieira.com.pt',
'password' => 'Jk6gci3PyjhHk1'
]
]);
@apoca
apoca / gist:a9666ba74ef4625fcce7
Created June 8, 2015 12:15
client http apigility
$client = new Client([
'base_uri' => 'http://esolidar-api',
'headers' => ['Accept' => 'application/json'],
]);
$headers = ['Content-type' => 'application/json; charset=UTF-8', 'Accept' => 'application/json'];
$body = json_encode(array('username' => $params['username'], 'password' => $params['password']));
$request = new Request('POST', 'http://esolidar-api/users/auth', $headers, $body);
$statement = "SELECT id, name FROM users WHERE status = 'P'";
/**
* Query string
*/
public function queryString($statement)
{
$adapter = $this->adapter;
$results = $adapter->query($statement, $adapter::QUERY_MODE_EXECUTE);
return $results;