Merge pull request #65 from wagnert/master

diff reviewed
refactored socket buffer readin
fixed phpcs error
Merge with zelgerj/master
Merge with zelgerj/master