Silex: development question

Hi

Second question of the day in regards to Silex.

Suppose I have this piece of code:

$app->get('/mails/', function() use($app) {
	   return $app['twig']->render('index.html', array(
			'object' => getObject(),
		));
	});

Where do I place the getObject function? Do I just leave it in the index.php file, or do I create a new file and just include the new php file?


Is it still possible to create own classes, as if you weren’t using a framework, or is there another way to create a class (a service maybe?)?

Thx!

Silex was designed for building single-file apps, so without knowing more about your code, I’d suggest keeping that function in index.php.

ok :slight_smile: i only have 2 routes defined and will only have 2 functions including the getObject one :slight_smile:

thx