Coder Social home page Coder Social logo

php-sonic's Introduction

php-sonic

Build Status Latest Stable Version Total Downloads

PHP client of Sonic search

Requirements

  • PHP >= 7.0

Install

composer require php-sonic/php-sonic

Usage

See example

php-sonic's People

Contributors

hanspagel avatar seijikun avatar touhonoob avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

php-sonic's Issues

Join forces?

Hey! I'm the other guy who wrote a php client library for Sonic in parallel.
I guess it wouldn't make much sense maintaining two, so I would like to propose merging the libraries.

Some things coming to mind:

  • I had a quick look at your library and saw, that our APIs are very similar
    • You have three flush methods (flusho, flushb, flushc), I have only one
    • Many of your methods don't return the results that Sonic reports. (e.g. pop() or the flush-methods)
  • Is there a reason why you are using PHP's socket extension? The stream API is built in and supports reading until a certain delimiter is found, which is probably more performant than your readBuffer() implementation.
  • While my SonicMessage helper class might have been a bit overengineerd in the end, I think your ingest implementation is too easy. When starting a session with Sonic, Sonic tells one about the size of its receive buffer. If messages longer than this are sent to the server, Sonic will close the connection. Furthermore: If the input you get for either push(), pop(), query() or suggest() contains a newline, or a " your implementation should break. That may even be a security risk.
  • You are often using preg_match() to parse responses. We probably need a benchmark for this, but I would guess that that is way more expensive than strsplit().

What do you think?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.