You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+16-5Lines changed: 16 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,8 +51,9 @@ You must provide a single file that can be `include()`ed in order to run your
51
51
legacy applcation. Typically you will already have this - it should be your
52
52
legacy application's front controller.
53
53
54
-
This file should _return_ the HTTP status code sent by the legacy application.
55
-
This is because the `http_response_code()` function is not available until PHP 5.4.
54
+
If you are running PHP < 5.4, this file should _return_ the HTTP status code
55
+
sent by the legacy application. Starting with PHP 5.4, `http_response_code()`
56
+
will be used to detect it.
56
57
57
58
Also, as this bundle will try to capture the response including headers using
58
59
output buffering, you must not flush the response body or headers
@@ -83,8 +84,17 @@ class MyController ...
83
84
}
84
85
```
85
86
86
-
There are two ways of mixing your legacy world with your new world: Either you create a new layout and embed parts of
87
-
the legacy application, or you retain your old layout and embed new parts in it.
87
+
This will run your legacy application before entering the controller. The entire output including
88
+
HTTP headers (repeat after me: including HTTP headers) will be captured and saved. *Nothing* will
89
+
be sent to the client unless you take care of doing so.
90
+
91
+
Regarding the legacy response body, there are two ways of mixing your legacy world with your new world: Either you create a new layout and embed parts of
92
+
the legacy application, or you retain your old layout and embed new parts in it. The following sections
93
+
explain both of them.
94
+
95
+
Regarding HTTP headers and especially cookies sent by the legacy application make sure
96
+
you don't miss the filters explained further below. For example, if your legacy code uses `session_start()`
97
+
you probably need to forward the session cookie.
88
98
89
99
### Using XPath to embed parts of the legacy response in your new layout
90
100
@@ -183,7 +193,8 @@ In particular,
183
193
-@Legacy\Passthru will send the legacy application's response as-is, so the controller itself will never be run
184
194
-@Legacy\IgnoreRedirect will bypass the controller if the legacy application sent a Location: redirect header.
185
195
-@Legacy\IgnoreHeader("some-name") will bypass the controller if the legacy application sent "Some-Name:" header. This can be used to make the legacy application control execution of the Symfony2 controller (use with caution).
186
-
196
+
-@Legacy\KeepHeaders will apply *all* HTTP headers found in the legacy response and add them to the response created by Symfony controller. You can also selectively pick headers via `@Legacy\KeepHeaders({"X-Some-Header", "X-Some-Other"})`
197
+
-@Legacy\KeepCookies works like `KeepHeaders` but peeks at cookie names.
0 commit comments