Getting started with the Bingo MVC framework

Bingo MVC artwork

The Bingo Framework is one blip in a sea of PHP MVC mother-ships. I built Bingo because I wanted to prove to everybody that I’m the one billionth coming of Taylor Otwell and have tried to maintain it to a point where it can function in a manner similar to the more recognizable, Google-search friendly PHP frameworks.

I was told by a colleague that the documentation for my ambitious project needs fixing. I was vexed until he prescribed that I do the one thing every sane person does; write an article and post it on Medium. That is exactly what this post is: a brief but comprehensive guide to creating your first Bingo-powered application.

First, install the package. This installation can be done via Composer by typing the following in a Command Line Interface of your choosing.

You can also clone the source code from GitHub.

Second, create a virtual host for the framework if you are using an Apache web server.

Third, update the composer.json file: include the Codebird library which will be used to interact with the Twitter RESTful web service.

Fourth, add the Codebird library and corresponding Twitter model to the dependency injection table in Bingo to enjoy the inversion of control it offers.

Since the tokens and secrets are of extreme importance, saving their values in the Config file in the App directory is worth doing.

Fifth, create a new model in the models directory named Twitter.php. This model will provide the Codebird abstraction that is required.

Sixth, create a controller also called Twitter.php in the controllers directory which is somewhere in the App folder to glue all the pieces together. The controller logic will, in addition to fetching the data from the Twitter model, allow for the creation of a user interface which will be conveyed to the user. The following code should suffice.

Next, edit the HTML file base.html in the Mustache directory to reflect the structure of the twitter data.

Finally, write some styles and a simple color script to make the application look a lot more like a Picasso painting and a lot less like a kindergarten art project.

The accompanying script looks a lot like this:

That’s it. If you encounter any problems, please contact me. Also, please star my repository.

I write PHP and I know things — kind of.

I write PHP and I know things — kind of.