Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Kirill Nesmeyanov
    @SerafimArts
    what?
    Taras Lisennk
    @Lisennk
    Mda
    Kirill Nesmeyanov
    @SerafimArts
    i dont understand u
    Taras Lisennk
    @Lisennk
    ай ноу
    Kirill Nesmeyanov
    @SerafimArts
    cmon bro
    hmmm
    Taras Lisennk
    @Lisennk
    But what if i use OOP? If i will wrap all code to resolve/reject, than it will be in functional style, not in OOP.
    Kirill Nesmeyanov
    @SerafimArts
    my example are broken
    php are functional lang too
    Taras Lisennk
    @Lisennk
    but u cant mix it. Please, give me link to line where you use promises in your bot?
    Taras Lisennk
    @Lisennk
    Yeah, and its ugly as f*ck. May be there is feature like 'await' in React PHP EventLoop?
    Kirill Nesmeyanov
    @SerafimArts
    this is impossible
    event loop contents a little more than 1 promise
    like [p1, p2, p3]
    every one second (as example) you process every item
    if you stop one item for wait a result - u stop all items in your event loop
    Taras Lisennk
    @Lisennk
    Ok, i get it. Thanks to ReactPHP, now i suffer in PHP too, not only in JS xD
    Kirill Nesmeyanov
    @SerafimArts
    if you wanna a concurrency, you can use The Threads :D
    Taras Lisennk
    @Lisennk
    I need a sync way, dude. Or at least await. In my opinion, all this 'functional style' things is ugly.
    Kirill Nesmeyanov
    @SerafimArts
    await is an alias for all()function
    lol
    just use it if you want a behaviour like await operator in JS
    Taras Lisennk
    @Lisennk

    i get it, but its still ugly. I like C# way:

    $data = await $api->getData();

    And so on

    But thanks anyway, @SerafimArts. Like always, helped me a lot.
    Kirill Nesmeyanov
    @SerafimArts
    async some() {
      var a = await fetch(...);
      var b = await fetch(...);
    
      return [a, b];
    }
    ===
    function some() {
        $a = fetch(...);
        $b = fetch(...);
    
        return all([$a, $b]);
    }
    @Taras-S this is SIMILAR examples
    first js, second php
    async functions with await usage returns...
    PROMISE
    magic!
    Taras Lisennk
    @Lisennk
    and i can use it in sync style?
    ... some code
    $data = some();
    ... some code
    Kirill Nesmeyanov
    @SerafimArts
    no
    some().then(data => {});
    or
    some()->then(function(data) { });
    this is a similar usage of this js and php examples
    Taras Lisennk
    @Lisennk
    I get it. Its not await like in C#. But thanks, i will use it.
    LeonineKing1199
    @LeonineKing1199
    This is the gitter about using PHP like Node, right?
    Oh wow, August 3rd.
    Basically, I'm sick of Node and this looks like a good substitute.
    How do I convince my team that hates PHP that reactphp is worth switching too?
    I've been looking for new languages. I want something scripty, with a mature library and something with a palatable syntax.
    I think PHP would be good.
    Werner Roets
    @panzer-planet
    PHP is far, far better for writing server code than JS. ES6 would make life easier, but it's still not ideal. The problem is (like you said your team hates PHP), that PHP has a reputation of being a dirty language for beginner programmers making wordpress plugins or amateur websites. Realistically, PHP is an incredibly stable and feature rich language that is easy to use and incredibly productive. In the node world it's just far too easy to write bugs into your program. The main problem is prototypal objects in JS. The fact that you can assign to non-existent properties or overwrite exising ones. JS programmers seldomly come from a more formal background and that means they are not familiar with the concept of data hiding. I firmly believe that JS is the wrong language for server software, and probably not truly suitable for large projects.
    JD Williams
    @jdwil
    has anyone here set up the symfony kernel to run via a react loop? There are many posts about it that are purely concerned with speed, but I want to know how it works functionally. I was imagining a use case like this... the kernel is handed a request and I could set up an early event listener to inspect the request and determine if I'm going to need information from a 3rd party api. If so I kick off the request(s) asynchronously and let the kernel keep chugging along. Then at the point where I need the data, check to see if the requests are complete and block until they are. If I run the kernel from within a react loop, and inject that loop into the symfony container, and use that same loop for the http requests, would that do it? Anyone done something like that? Is it worth it or am I trying to use async in a place it doesn't belong? Seems like it would be very efficient.
    mirik999
    @mirik999
    He everyone
    webDEVILopers
    @webdevilopers

    Hi there! I'm new to ReactPHP, especially Event loops.

    My use case:
    An asynch microservice generates a PDF. The process may only take a second. But there maybe are a lot jobs in the queue.
    After successful generation an event is fired. It is produced by the generation microservice and passed to a rabbitMQ queue.
    Then my Core Microservice subscribes to the event. The Process Manager updates my Projection and sets an ID from NULL to the value from the event.

    In my application:
    A repository method (ORM to mysql) returns NULL or an ID. I have to query the method for about 60 seconds waiting for it to reutrn the ID.
    Otherwise it is a timeout or the PDF could (yet) not be generated. Throw message to User Interface.

    This is the code that's currently working for me:
    https://gist.github.com/webdevilopers/71162ce725576990a7437e48eed676fd

    Any feedback would be appreciated.

    Adrián Norte
    @anortef
    Hello people
    is there a good guide on how to use reactphp with symfony?
    thanks :)