Copyright (c) 2008 Kris Wallsmith
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Usage
The generate:controller task creates a front controller in your project's web/ directory:
./symfony generate:controller frontend dev
Traffic to this controller can be restricted by IP address by using the --allowed-ip option:
./symfony generate:controller frontend dev --allowed-ip="127.0.0.1"
This common use case can also be accomplished using the localhost shortcut (which also adds the IPv6 equivalent):
./symfony generate:controller frontend dev --allowed-ip="localhost"
If you want to use a filename other than the symfony default filename, use the --filename option:
./symfony generate:controller frontend dev --filename="index"
The controller can be configured to listen to the server for configuration variables using the check-server option:
./symfony generate:controller frontend prod --check-server
This option will add logic to your controller to first look for SF_APPLICATION, SF_ENVIRONMENT and SF_DEBUG keys in the $_SERVER array. If these keys are not found, the command arguments are used as fallback values.
Using the check-server option you can create an index.php controller that can dispatch any application, depending on what SetEnv directives exist in the requested VirtualHost configuration. This feature is Apache-specific.
./symfony generate:controller frontend prod --filename="index" --check-server --force
Changelog
1.1.0
- Added option to check server for configuration values
- Added exception if file already exists and
--force option to overwrite
- Migrated
README to Markdown for new plugins system
1.0.0