
Show HN: PHP Code Generator – A scaffolding framework - asika32764
http://about.asika.tw/php-code-generator/
======
lkrubner
So now we have PHP, which started as a lightweight script language, following
Java down the road toward a more verbose style, and so now we need code
templates? Java programmers have been doing this for awhile, they rely on IDEs
such as Eclipse or IntelliJ to write some of the boilerplate for them, and
that is important in a language like Java, which has so much boilerplate. But
with Java, that boilerplate at least buys you something: static typing and
type checks, which allows the compiler to check for bugs, and which offers
immense benefits in terms of speed. In PHP, we get... what? Apparently PHP is
now verbose enough that people feel the need to write code templates for it,
but what benefit do we get in exchange for all of that boilerplate? PHP is
still dynamic, and it is still very slow.

This seems like the worst of all worlds.

~~~
debacle
PHP has a real glut of talented programmers right now, which is why you're
seeing the same overengineering that plagues Java. Fun problems have dozens of
solutions because everyone wants to work on them. Templating is just one of
those. Weird, case-specific conventions are another.

~~~
Gigablah
This isn't really anything new. Yii and Symfony have been doing code
generation for years. Someone simply decided to create a library that's not
framework specific.

~~~
debacle
The problem is that everyone is creating every library, over and over. It is a
real problem in PHP that there is no single, polished solution and every
framework is being reinvented (and breaking BC) constantly.

~~~
Gigablah
That's why I hope StackPHP gets some traction and more people create framework
agnostic libraries (e.g. phpleague).

~~~
mtbcoder
I'm not familiar with StackPHP but how agnostic is it? The first middleware
listed (HttpCache) relies heavily on Symfony.

~~~
alexbilbie
It relies on a single Symfony component which has become the standard for
almost every HTTP package.

You don't need to download the entire Symfony framework

~~~
mtbcoder
Right, but that's a large, core Symfony component, not a small library. It
essentially dictates how you handle fundamental tasks (such as routing) and
immediately starts you off doing things the "Symfony way".

~~~
Gigablah
Eh, it doesn't dictate how you handle routing. I think you're misunderstanding
the dependency here: what StackPHP depends on is the HttpKernel _interface_.
Basically the function signature for a HTTP request handler.

It does tie you into the Symfony Request object, but otherwise there are no
other dependencies.

------
angrybits
I have been writing an application that is a thin PHP application on top of a
relational model that implements (what I hope is) a clever business.

This framework would not solve a single problem I have had. None of the
frameworks do, which is why I'm not using one of them. The only thing I really
found lacking in core PHP was a way to manage the urls. (In this case, query
strings.) I believe this would have been difficult on any platform, as the
data is deeply hierarchical so the urls would be gnarly no matter what. So I
wrote a class that understands the entity hierarchy and can generate query
string sets that are needed for each level in the scope.

I wish the PHP community would spend less effort trying to be rails and more
effort on simply removing pain points of basic, idiomatic PHP development.

------
EGreg
This is done by [http://platform.qbix.com](http://platform.qbix.com) as well.
You may wish to look at
[http://platform.qbix.com/guide/models](http://platform.qbix.com/guide/models)

------
based2
[https://minuteproject.wikispaces.com/Propel](https://minuteproject.wikispaces.com/Propel)

[https://minuteproject.wikispaces.com/Php+doctrine](https://minuteproject.wikispaces.com/Php+doctrine)

~~~
RossM
Scaffolding in terms of code templates, rather than data model scaffolding.

------
Mahn
As someone who has never used a code generator before, what is the use case
for this?

~~~
dawnstra8
It helps you solve the problem quicker and more cleanly.

------
Gigablah
So this is basically a PHP version of Yeoman?

