Almost a bit egotistical and arrogant of a title for two pieces of “library” that are almost rip offs of other frameworks if not already rip offs. I am looking at you, container.

What is the purpose of all this? Why even attempt to re-invent the wheel of what’s already been done? Why not subject your self to the whims of frameworks and existing powerful bodies of development? Why be different, if different at all?

Ice Cream is a set of components that I may roll into a very simple framework and even, gasp, put to the test by, gasp some more, releasing an app built with them.

But to do that I need the communities input, eyes and ever lasting glare and hate for anything new.

Let’s see what I have built thus far.

Ice Cream DI

composer install ice-cream/di

Even the README, blatantly states this is a rip of off the famous and well respected pimple.

It should be familiar to you (least those of you familiar with pimple):

use IceCreamDI\Container;

$container = Container();

$container['service'] = function($c) {
  return new Service();
}

$container['services'] // Returns instance of Service class.

That’s it. Literally that simple. Obviously there are other methods you can call and more you can do, but you’ll have to checkout the README for a full understanding of “how do I use x”

Why would you build this? There’s already tons of DI out there, some would say we are saturated with the amount of libraries that offer DI.

Because I wanted to be the next droplet of water in the ocean. Ripples I may not make, but ideas I might spark.

I also chose to build this to say that I could build this, based off some ones already existing idea. I thought I would try and build this as a NON throw away project, that is one I can use and build upon and maybe one day get community input on.

I prefer my DI to use objects, not this Array jazz you “pretend” to use.

While I think objects are fun, I have looked at a few DI based implementations and they take things to a whole java based level of “enterprise.” Some rightly so as they are apart of frameworks (cough symphony) that are meant for enterprise development.

This particular container was designed to be light weight, easy and highly flexible. I challenge you to find one thing with it you can’t do that you could do with and object based container. I will either implement it and show you the simplicity or I will say you’re right.

We can’t please every one, but we can damn well try.

Ice Cream Router

composer install ice-cream/router;

This one was harder to build. I didn’t really have many sources to go off, sure I had Laravel, Silex and Slim, but at the end of the day I wanted something even simpler.

So I built a tiny wrapper around Symfony’s Router called Ice Cream Router.

At the core of it all, it’s the simplest and easy to use router you will ever find. Maybe that is its own fault. Maybe it’s too simple. Why don’t you judge for your self?:

use IceCreamRouter\Router;

$router = new Router();

$router->get('/foo/{id}', 'foo', function($id, $request, $response){
  return response->setContent('Id is: ' . $id);
});

$response = $router->processRoutes(Request::create('/foo/1', 'GET'));

var_dump($response->getContent()); // => Id is: 1

This is the simplest example of the router you will find. This shows you that we can create request with information in the url and create a response with the information returned.

As with the the container you will have to check the README for the associated information on how to do other things and how to use it fully.

Community input is for sure required as I am sure they will have questions, but if you reading this, chances are you came from Reddit. Specifically, the PHP side of things.

What’s Next?

I have no idea. I want to try and take these two component and build the basis for a framework. What would that framework be good for? JSON responses mostly. I want this to be a very slim (no pun intended) and sleek framework used for creating API’s.

I might take a look at other frame works and see what else I will need. I could leave every thing else up to you and ties the container and router together give you easier access to handling requests and leave CSRF up to you and such, but I haven’t decided how evil I want to be.

To Discouraged to Build Anything New

Clearly I am not discouraged at all, specifically if I am building something new and showing it to you and hoping, ever so desperately, that you will have idea, pull requests, stars and thoughts on what specifically I have shown you.

My desperation soaks through my tunic like that of a man on the run from the mob in Salem. I have got to stop watching Salem.

The point is, hopefully this is a turning point, with the good, comes the bad. With the beautiful comes the ugly. So bring on the whips, and lets play fifty shades of coding.