The frontend is pure static HTML and JS, communicating with a pure
JSON API I feel like Silex is the perfect framework for this type of
architecture.
Here are a couple questions I had while developing the Silex part of
the app:
1/
$app->json() is not consistent with PHP's json_encode when applying on
an empty PHP array ($app->json() returns the empty object, `{}`, while
json_encode returns the empty array, []).
Is this the expected behavior, and why?
2/
When looking to accept JSON requests in the request's body (which
Backbone does by default), I'd like to retrieve the whole parameter
set/object at once (not attribute per attribute through $request-
>request->get()) is there any way I can do that, that would be more
elegant than just adding a `data` attribute to $app?
> The frontend is pure static HTML and JS, communicating with a pure
> JSON API I feel like Silex is the perfect framework for this type of
> architecture.
> Here are a couple questions I had while developing the Silex part of
> the app:
> 1/
> $app->json() is not consistent with PHP's json_encode when applying on
> an empty PHP array ($app->json() returns the empty object, `{}`, while
> json_encode returns the empty array, []).
> Is this the expected behavior, and why?
> 2/
> When looking to accept JSON requests in the request's body (which
> Backbone does by default), I'd like to retrieve the whole parameter
> set/object at once (not attribute per attribute through $request-
>> request->get()) is there any way I can do that, that would be more
> elegant than just adding a `data` attribute to $app?
By the way, I realize my two questions are probably more "Symfony
Components"-related than specifically Silex, but when coming to Silex
directly (with no or little experience in Symfony) the line can be hard to
trace.
>> The frontend is pure static HTML and JS, communicating with a pure
>> JSON API I feel like Silex is the perfect framework for this type of
>> architecture.
>> Here are a couple questions I had while developing the Silex part of
>> the app:
>> 1/
>> $app->json() is not consistent with PHP's json_encode when applying on
>> an empty PHP array ($app->json() returns the empty object, `{}`, while
>> json_encode returns the empty array, []).
>> Is this the expected behavior, and why?
>> 2/
>> When looking to accept JSON requests in the request's body (which
>> Backbone does by default), I'd like to retrieve the whole parameter
>> set/object at once (not attribute per attribute through $request-
>>> request->get()) is there any way I can do that, that would be more
>> elegant than just adding a `data` attribute to $app?
> --
> You received this message because you are subscribed to the Google Groups
> "Silex PHP microframework" group.
> To post to this group, send email to silex-php@googlegroups.com.
> To unsubscribe from this group, send email to silex-php+unsubscribe@**
> googlegroups.com <silex-php%2Bunsubscribe@googlegroups.com>.
> For more options, visit this group at http://groups.google.com/** > group/silex-php?hl=en <http://groups.google.com/group/silex-php?hl=en>.
> The frontend is pure static HTML and JS, communicating with a pure > JSON API I feel like Silex is the perfect framework for this type of > architecture.
> Here are a couple questions I had while developing the Silex part of > the app:
> 1/ > $app->json() is not consistent with PHP's json_encode when applying on > an empty PHP array ($app->json() returns the empty object, `{}`, while > json_encode returns the empty array, []). > Is this the expected behavior, and why?
> 2/ > When looking to accept JSON requests in the request's body (which > Backbone does by default), I'd like to retrieve the whole parameter > set/object at once (not attribute per attribute through $request- > >request->get()) is there any way I can do that, that would be more > elegant than just adding a `data` attribute to $app?