News for hackers. Stuff that matters.
Re:Fuel - A simple and flexible PHP Web Framework by lastkarrde on Sunday April 10, 2011 @12:53AM (#2428843)
Does anyone know why Fuel uses a mixture of Zend_Style class naming and namespaces? For example controllers are prefixed by Controller_ and are in the root namespace while tasks are put in the namespace Fuel\Task with no class prefix.

  class Controller_Foo{}

  namespace Fuel\Task;
  class Foo{}
It seems confusing.
Re:Fuel - A simple and flexible PHP Web Framework by philsturgeon on Sunday April 10, 2011 @05:28AM (#2429222)
Fuel does not namespace everything as there is no need.

There are 4 main namespaces.

Fuel\Core Fuel\App Fuel\Tasks Fuel\Migrations

Then packages have their own namespace too.

These help code that could potentially have the same name exists and allows for easy extending of core classes.

Class Foo extends Fuel\Core\Foo.

Thanks to a cascading file system very similar to Kohamas this is all very simPlenand very quick.

The Zend_Style_Class equates to classes/Zend/style/class.php and could exist in core or app, or packages, etc.

Re:Fuel - A simple and flexible PHP Web Framework by pan69 on Sunday April 10, 2011 @01:25AM (#2428910)
I was unable to find this in the Fuel guide but I think Fuel uses a cascading file-system similar to that of Kohana:

http://kohanaframework.org/3.0/guide/kohana/files

Re:Fuel - A simple and flexible PHP Web Framework by lastkarrde on Sunday April 10, 2011 @02:20AM (#2428998)
Seems pretty lazy... it would be trivial to change the autoloader to check a Controller namespace/directory.
Re:Fuel - A simple and flexible PHP Web Framework by pan69 on Thursday April 14, 2011 @01:35AM (#2445771)
It has nothing to do with laziness. It allows you to override any part of the system without actually changing any of the core framework or module files.
Re:Fuel - A simple and flexible PHP Web Framework by alanstorm on Sunday April 10, 2011 @01:27AM (#2428912)
I can't comment specifically on the Fuel framework, but it's probably going to take years (if ever) for "the right" way to use namespaces to emerge among the PHP communities. There's been a decade plus of ingrained name-spacing by convention that PHP developers will need to shed
Re:Fuel - A simple and flexible PHP Web Framework by jasonlotito on Sunday April 10, 2011 @07:13AM (#2429304)
There is already a standard.

http://groups.google.com/group/php-standards/web/psr-0-final...

Voted on back in 2009 by members of Solar, Cake, Doctrine, Zend, Symfony, Typo3, PHP Core, Yahoo! and others.

Re:Fuel - A simple and flexible PHP Web Framework by jschreuder on Sunday April 10, 2011 @05:17PM (#2430433)
We actually keep pretty close to that, but have two implementational differences: 1. Namespaces are linked to a specific directory instead of just translated to a path 2. Our paths are fully lowercase

And I stand by those. The first allows for more flexibility when it comes to code organization and the second makes mistakes in classloading a lot less common. You can disagree with these but we have documented them clearly. Also it's quite easy to add another autoloader, ours won't even do a filesystem check when trying to load from an unknown namespace so it should add hardly any overhead to attach a Zend (or anything) compatible loader.

Re:Fuel - A simple and flexible PHP Web Framework by lastkarrde on Sunday April 10, 2011 @02:19AM (#2428992)
Doctrine2 and Lithium took the lead and went 100% namespaces. Other projects such as Symfony2 and Solar2 have followed suit.
Re:Fuel - A simple and flexible PHP Web Framework by trafficlight on Sunday April 10, 2011 @01:05AM (#2428866)
It's in the PHP style guide? Maybe?
Re:Fuel - A simple and flexible PHP Web Framework by lastkarrde on Sunday April 10, 2011 @02:28AM (#2429012)
Nope.

Previous to PHP5.3 (when namespaces were introduced) most frameworks followed the Zend_Style_Of_Naming (That class would be located in Zend/Style/Of/Naming.php).

All new frameworks that support PHP5.3+ (with the exception of Fuel, it seems) have done away with Zend_Style_Naming and follow direct namespace <-> file mapping.

Re:Fuel - A simple and flexible PHP Web Framework by soulclap on Sunday April 10, 2011 @01:27PM (#2429909)
Seriously just curious, what are 'all new frameworks that support PHP5.3+' that are complying to that? And even with namespaces, I guess there are still a couple of ways on how to do this in the file system and handle autoloading. What's the 'standard' then?
Re:Fuel - A simple and flexible PHP Web Framework by jasonlotito on Sunday April 10, 2011 @04:46PM (#2430366)
I mentioned this in another comment.

http://groups.google.com/group/php-standards/web/psr-0-final...

Was 'ratified' by some of the bigger framework developers out there a while ago.