profile
viewpoint
Joao Gilberto Magalhaes byjg ByJG Winnipeg, MB, Canada https://www.linkedin.com/in/joaogilberto Give me a lever long enough and a fulcrum on which to place it, and I shall move the world.

byjg/anydataset 9

Anydataset Core Module. Anydataset is an agnostic data source abstraction layer in PHP.

byjg/automate 7

Native bash script for automate tasks in a multiple servers

byjg/cache-engine-php 4

A multi-purpose cache engine PSR-6 and PSR-16 implementation with several drivers.

byjg/docker-bash-scripts 4

Here you can find a collection of docker bash scripts to automate some tasks

byjg/anydataset-nosql 3

A NoSql abstraction dataset. Anydataset is an agnostic data source abstraction layer in PHP.

byjg/activemq-easy-config 2

Create a Network of Brokers using a simple tool to make the process easier.

byjg/anydataset-text 2

Anydataset Text File abstraction. Anydataset is an agnostic data source abstraction layer in PHP.

byjg/authuser 2

A simple and customizable class for enable user authentication inside your application. It is available on XML files, Relational Databases and Moodle.

byjg/b8 2

b8 is a statistical ("Bayesian") spam filter implemented in PHP

byjg/codegenx 2

Code generator highly flexible and extensible based on Torque XML and XSL transformations

issue commentbyjg/jwt-session

Please create a simple example app which will show us how to use the package with a front-end framework

It is possible to use the token created by JwtSession in your PHP application since you share the same secret key between your two applications:

In the JwtSession you can create:

$sessionConfig = (new \ByJG\Session\SessionConfig('example.com'))
    ->withSecret('your super base64url encoded secret key')

And in your API application you can use the same key:

$server = "example.com";
$secret = new \ByJG\Util\JwtKeySecret('your super base64url encoded secret key');

$jwtWrapper = new \ByJG\Util\JwtWrapper($server, $secret);
# $token = extract the JWT Token. If the server name is the same for both and you are 
#          passing the token through  HTTP_AUTHENTICATION header you don't need this step. 
$data = $jwtWrapper->extractData($token); 

Remember: both host and secret should be the same.

I recommend you to use:

  • https://github.com/byjg/jwt-wrapper for your API
  • https://github.com/byjg/config to manage you configuration between environments and manage the DI of the components

Thank you @byjg really appreciate it

manyopensource

comment created time in an hour

startedbyjg/jquery-sse

started time in 2 days

startedbyjg/jquery-sse

started time in 2 days

issue commentbyjg/jwt-session

Please create a simple example app which will show us how to use the package with a front-end framework

Hi @byjg, I really like this. Am I able to use JWT Session side by side with JWT wrapper? Say, I build a PHP application for the web, but also open up some API for mobile later on, is that possible?

Thank you!

manyopensource

comment created time in 2 days

startedbyjg/php-swagger-test

started time in 3 days

issue closeddomnikl/DesignPatternsPHP

CircuitBreaker pattern

Do you think it is valid for me to implement the CircuitBreaker pattern?

closed time in 4 days

raphaeldealmeida

issue commentdomnikl/DesignPatternsPHP

Hello 。When I run phpunit, this error occurs. How can I solve it? Thank you

Hi @sunmengkai, based on your directory structure, you are not running phpunit from the repository root, thus not loading the phpunit.xml.dist configuration which contains the bootstrap (composer's autoloader). Please either run it in the correct directory or explicitely load the configuration file.

sunmengkai

comment created time in 4 days

startedbyjg/jwt-wrapper

started time in 6 days

startedbyjg/migration

started time in 6 days

startedbyjg/jwt-session

started time in 6 days

issue closedwandenberg/nginx-push-stream-module

Custom 404 / channel inactive message

To identify inactive channels, we currently look for push stream's 404 responses on the publish location. To better debug our application, we would like to distinguish normal 404's from channels with no subscribers.

We tried a custom 404 to a internal location, e.g. error_page 404 @404 but push stream module seems to ignore it and still returns its own 404?

Thanks!

closed time in 7 days

ajnsn

issue commentbyjg/migration

[Sql Server] Error migrating tables

Finally it works using this command

vendor/bin/migrate reset --path /Users/a/migration-tool/vendor/byjg/migration-cli/example/sql_server sqlsrv://sa:MssqlP455123@localhost:1433/testdb
2021-01-18 06:09:22.44 spid56      Starting up database 'testdb'.
2021-01-18 06:09:22.64 spid56      Parallel redo is started for database 'testdb' with worker pool size [3].
2021-01-18 06:09:22.65 spid56      Parallel redo is shutdown for database 'testdb' with worker pool size [3].

If using API, I have an error

Fatal error: Uncaught PDOException: SQLSTATE[HYT00]: [Microsoft][ODBC Driver 17 for SQL Server]Login timeout expired in /code/vendor/byjg/anydataset-db/src/PdoSqlsrv.php:28 Stack trace: #0 /code/vendor/byjg/anydataset-db/src/PdoSqlsrv.php(28): PDO->__construct('sqlsrv:server=0...', 'sa', 'MssqlP455123') #1 /code/vendor/byjg/anydataset-db/src/Factory.php(51): ByJG\AnyDataset\Db\PdoSqlsrv->__construct(Object(ByJG\Util\Uri)) #2 /code/vendor/byjg/anydataset-db/src/Factory.php(16): ByJG\AnyDataset\Db\Factory::getDbInstance(Object(ByJG\Util\Uri), NULL) #3 /code/vendor/byjg/migration/src/Database/DblibDatabase.php(18): ByJG\AnyDataset\Db\Factory::getDbRelationalInstance('sqlsrv://sa:Mss...') #4 /code/vendor/byjg/migration/src/Migration.php(211): ByJG\DbMigration\Database\DblibDatabase::prepareEnvironment(Object(ByJG\Util\Uri)) #5 /code/vendor/byjg/migration/example/sql_server/test_sqlserver.php(16): ByJG\DbMigration\Migration->prepareEnvironment() #6 {main} thrown in /code/vendor/byjg/anydataset-db/src/PdoSqlsrv.php on line 28

Then I change localhost to sql1(container name) because both php and sql server each in the different container but they're both linked. I don't know why using localhost doesn't works inside docker, maybe you have clue ? but this works $uri = new \ByJG\Util\Uri('sqlsrv://sa:MssqlP455123@sql1/testdb');

Thanks a lot

c4ndle

comment created time in 10 days

pull request commentbyjg/migration

Next Revision

🎉

byjg

comment created time in 11 days

issue commentbyjg/migration

[Sql Server] Error migrating tables

btw, is it works on your local environment ?

Yes, it is, but I would like just to make sure everything is OK. Could you tell more specific how do you do that from the ground up @byjg

c4ndle

comment created time in 12 days

fork lccro/pakitheme

Automatically install your host GTK+ theme as a Flatpak

fork in 14 days

startedbyjg/jquery-sse

started time in 15 days

fork ZILosoft/docker-nginx-extras

Nginx extended version: provides a version of nginx with the standard modules, plus extra features and modules

fork in 15 days

issue commentbyjg/migration

[Sql Server] Error migrating tables

updating dev-next after edit composer.json looks good

$ composer require byjg/migration:dev-next
./composer.json has been updated
Running composer update byjg/migration
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Generating autoload files

And then I have an exception command not found

migration-cli a$ scripts/migrate --path /Users/a/migration-tool/vendor/byjg/migration/example/sql_server  reset sqlsrv://sa:MssqlP455123@sql1:1433/testdb -v

In Application.php line 676:
                                                                                              
  [Symfony\Component\Console\Exception\CommandNotFoundException]                              
  Command "/Users/a/migration-tool/vendor/byjg/migration/example/sql_server" is not defined.  
                                                                                              

Exception trace:
  at /Users/a/migration-tool/migration-cli/vendor/symfony/console/Application.php:676
 Symfony\Component\Console\Application->find() at /Users/a/migration-tool/migration-cli/vendor/symfony/console/Application.php:237
 Symfony\Component\Console\Application->doRun() at /Users/a/migration-tool/migration-cli/vendor/symfony/console/Application.php:149
 Symfony\Component\Console\Application->run() at /Users/a/migration-tool/migration-cli/vendor/byjg/migration-cli/scripts/migrate:23

Do I have to update https://github.com/byjg/migration-cli too ?

using composer require 'byjg/migration-cli=4.0.*'

vendor/bin/migrate reset sqlsrv://sa:MssqlP455123@sql1:1433/testdb -v
This will ERASE all of data in your data. Continue with this action? (y/N) y
Connection String: sqlsrv://sa:MssqlP455123@sql1:1433/testdb
Path: /Users/a/migration-tool/migration-cli
-- Error migrating tables --
ByJG\DbMigration\Exception\DatabaseDoesNotRegistered
Scheme "sqlsrv" does not found. Did you registered it?
c4ndle

comment created time in 16 days

issue commentthephpleague/omnipay

How a "429 Too Many Requests" or equivalent should be handled?

Maybe a good implementation on the omnipay-common side would be an \Omnipay\Common\Http\Exception\TooManyRequestsHttpException extending \Omnipay\Common\Http\Exception\InvalidRequestException in the line of the symfony/http-kernel component.

WDYT @udgej?

devnix

comment created time in 16 days

issue commentbyjg/migration

[Sql Server] Error migrating tables

Hello, sorry I can not test it soon (busy with client side development). I will contact you again in 2 days, btw, is it works on your local environment ?

c4ndle

comment created time in 16 days

startedbyjg/jquery-sse

started time in 16 days

issue commentwandenberg/nginx-push-stream-module

Apple Silicon "ngz_slab_alloc() failed: no memory"

Well, good news, it did not give me an error with the changes above.

I am totally down to get on a Team Viewer. Wanna DM me on twitter and we can set something up? twitter.com/theberg

TheBerg

comment created time in 17 days

issue commentthephpleague/omnipay

How a "429 Too Many Requests" or equivalent should be handled?

Thinking out loud, I'm between this in RefundResponse::__construct()

throw new \Omnipay\Common\Http\Exception\RequestException('Too many requests', 429);

and this

throw new Omnipay\Common\Exception\RuntimeException('Too many requests', 429); // Or default 0 code

I've been looking through several Omnipay gateways and I don't find any implementing this, so I'm very concerned about how to proceed so my gateway would remain compatible with the rest of the existing ones.

devnix

comment created time in 17 days

issue openedthephpleague/omnipay

How a "429 Too Many Requests" or equivalent should be handled?

Hi! I'm improving an existing Redsys driver for Omnipay.

Currently, I have a queue of refunds for my project. A cronjob gets the unprocessed refunds of the queue, updates their status, logs the error if it happens, and marks it as executed.

I have an edge case with Redsys. When they consider that we are going too fast (they don't specify any rate limit) they give a 200 HTTP code with a custom status in the response with the code "SIS0295", which could be the HTTP equivalent of 429. In this case the error is logged but the refund is not marked as executed.

The thing is in the driver if I get an error I will throw an InvalidResponseException, but I don't know of a standard way to differentiate an error which will always occur against an error that I can fix by waiting for a few minutes and then trying again.

I've been poking around the PayPal driver, but I've not found any reference for handling 429 Unprocessable Entity - RATE_LIMIT_REACHED or similar.

created time in 17 days

issue commentdomnikl/DesignPatternsPHP

Hello 。When I run phpunit, this error occurs. How can I solve it? Thank you

There was 1 error:

  1. Error The data provider specified for DesignPatterns\Creational\AbstractFactory\Tests\AbstractFactoryTest::testCanCreateCsvWriterOnUnix is invalid. Error: Class 'DesignPatterns\Creational\AbstractFactory\UnixWriterFactory' not found E:\phpstudy\phpstudy_pro\WWW\index\DesignPatterns\Creational\AbstractFactory\Tests\AbstractFactoryTest.php:17

ERRORS! Tests: 1, Assertions: 0, Errors: 1.

sunmengkai

comment created time in 17 days

issue closedbyjg/webrequest

Request with HEAD method runs into timeout

HEAD requests are not successful. Example code:

<?php

require "vendor/autoload.php";

$httpClient = new \ByJG\Util\HttpClient();

$uri = \ByJG\Util\Uri::getInstanceFromString('http://example.com');
$request = \ByJG\Util\Psr7\Request::getInstance($uri)->withMethod('HEAD');

echo $httpClient->sendRequest($request)->getStatusCode() . "\n";

When setting CURLOPT_NOBODY it works again:

$httpClient->withCurlOption(CURLOPT_NOBODY, true);

As seen in guzzle: https://github.com/guzzle/guzzle/blob/master/src/Handler/CurlFactory.php#L263

This issue appears in byjg/php-swagger-test.

Thanks a lot.

closed time in 17 days

antonio-rylke-vgl

issue commentbyjg/webrequest

Request with HEAD method runs into timeout

Thanks a lot for this fast response and fix! php-swagger-test is able to test HEAD request.

antonio-rylke-vgl

comment created time in 17 days

PR opened thephpleague/omnipay

Added Arca (Armenian Card) payment gateway
+1 -0

0 comment

1 changed file

pr created time in 17 days

more