Live data from Hacker News

Crystal: PHP microframework based on anonymous functions

github.com

1–8 of 8 posts

Re: Crystal: PHP microframework based on anonymous functions

#3
post #2

Why use this instead of Slim? Slim is basically a fully-baked version of this (with a similar router), and it's decoupled, so you can use only the parts that you want.

It's more an experiment than a real microframework, it's absolutely not recommended for production. The contributing page should sound like a challenge :) https://github.com/EmanueleMinotto/crystal/wiki/Contributing

Re: Crystal: PHP microframework based on anonymous functions

#5
post #4

It looks interesting, but maybe consider setting it up as a Composer package?

I considered it, but for some reasons I didn't do it:

1. the main closure is useless if the .php file isn't included manually using require(_once)/include(_once) functions ( https://github.com/EmanueleMinotto/crystal/wiki/Tip ) because it returns directly at line 144 2. the autoloader become useless too, because there's Composer that does it very well 3. the PHP world is full of great frameworks, microframeworks, routers and other components, it will become rapidly a common library and not a good library because it doesn't follow development best practices but only a set of rules (defined in the CONTRIBUTING.md file)

Crystal can't be packed in a Composer package, but Composer can be used in a project including crystal.

Re: Crystal: PHP microframework based on anonymous functions

#6
post #2

Why use this instead of Slim? Slim is basically a fully-baked version of this (with a similar router), and it's decoupled, so you can use only the parts that you want.

It's more an experiment than a real microframework, it's absolutely not recommended for production. The contributing page should sound like a challenge :) https://github.com/EmanueleMinotto/crystal/wiki/Contributing

[deleted]

Re: Crystal: PHP microframework based on anonymous functions

#7
post #4

It looks interesting, but maybe consider setting it up as a Composer package?

I considered it, but for some reasons I didn't do it: 1. the main closure is useless if the .php file isn't included manually using require(_once)/include(_once) functions ( https://github.com/EmanueleMinotto/crystal/wiki/Tip ) because it returns directly at line 144 2. the autoloader become useless too, because there's Composer that does it very well 3. the PHP world is full of great frameworks, microframeworks, rou…

I like the minimalism of it - but I really don't like returning a value from an include like that.

Just seems wrong.

Personal preference though.

Re: Crystal: PHP microframework based on anonymous functions

#8
post #2

Why use this instead of Slim? Slim is basically a fully-baked version of this (with a similar router), and it's decoupled, so you can use only the parts that you want.

It's more an experiment than a real microframework, it's absolutely not recommended for production. The contributing page should sound like a challenge :) https://github.com/EmanueleMinotto/crystal/wiki/Contributing

What's the point of these restrictions?

They're not strange/crazy enough to make it a fun programming challenge, and for something that's intended for use (even non-production use) they make the code less usable.

"No namespaces" and "no new functions or classes" in particular don't make any sense. Anonymous functions are just like functions, except they're harder to identify in a stack trace.