Git Product home page Git Product logo

daemon-example's Introduction

Building PHP Daemons & Long Running Processes

This code is example daemons and long running processes related to the talk / workshop. The various branches show the process of creation from initial simplistic concept to a well formed long running process or daemon. This means that:

The associated branches will be rebased against master any time an example is added / updated!

Setup

If you're attending this as a workshop (or maybe you just want to take the examples for a spin), you should have these setup before hand:

Since you generally learn better when you're comfortable, you can certainly just use your local development environment if you're comfortable with installing those few dependencies.

Docker

The included docker-compse.yml should create the containers needed, and allow you to use mysql and beanstalkd as the hostnames for those services.

To install dependencies using composer, use the composer docker image:

docker run --rm -it -v `pwd`:/app composer install

Since everything is CLI, the php container will exit immediately. Use docker-compose run to get a shell in the (really a) php container. You'll be dropped into the project root and your container will be on the same network as the other containers:

docker-compose run --rm php

To access the MySQL database via the cli client:

docker-compose run --rm mysql mysql -h mysql -u workshop -p

And to view a console of the beanstalk queue, visit: http://localhost:2080

For how to install docker and docker-compose visit the official install guide.

Vagrant

Note: Docker is the preferred way to get a dev environment; however, this should still work.

The included vagrant configuration and bootstrap script should take care of all setup without any change to your local system:

vagrant up
vagrant ssh
cd /vagrant

For how to install vagrant, visit the official install guide. You'll also need VirtualBox as this vagrant 'box' is a VirtualBox image.

Support

If you have any problems setting this up prior to the workshop: create an issue, ping tjlytle on Twitter, or send me an email (my name is tim and I own timlytle.net, I'm sure you can figure it out).

Configuration

Edit config.php.dist and add your twitter oauth tokens, as well as your Nexmo credentials. If you're not using vagrant, you may also need to update the database credentials. Once edited, rename to config.php.

Tutorial

The longer form hands on workshop (using all the examples) given at:

  • php[world] 2017
  • ZendCon 2016

Talk

Originally a local PHP meetup talk, the shorter version has been given as a talk (using the twitter example) at these meetups / conferences:

  • LVPHP
  • php[tek] 2015
  • Nomad PHP
  • LoneStar PHP 2016
  • OpenWest 2016

daemon-example's People

Contributors

tjlytle avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

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.