 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Daniel Cousineau: Using Symfony Console From Scratch
by Chris Cornutt April 05, 2013 @ 12:46:43
Daniel Cousineau has posted a guide to using the Symfony Console component as a part of your application. It introduces you to some of the basics of using the component and has plenty of sample code to get you started.
CLI applications are extremely useful for many, if not most web projects. The Symfony framework even goes so far as to include an extensible CLI console used for everything from running cache cleanup/warmup tasks, to user account management. Many CLI scripts for web projects consist of just a static .php file which works fine but grow unweildy over time. Thankfully, the aforementioned Symfony Console component is released as a decoupled standalone that can be installed and setup easily and provide us with structure and organization (and some powerful features).
He walks you through the installation of the component via Composer and includes the code to make a simple CLI script using it. He shows how to make new commands (like his "TestCommand") and how to attach it to the application. He talks about output and input handling with arguments and options. He also shows an integration with an existing application with a base command class that helps to set up and configure the command objects that inherit it.
voice your opinion now!
symfony console tutorial introduction install usage
DZone.com: The Wheel Symfony Console
by Chris Cornutt March 13, 2013 @ 11:22:31
In this new post to DZone.com, Giorgio Sironi kicks off a series that looks at reusable components in the PHP development world. In this first post of that series he looks at the Symfony console component .
Symfony is one of the most popular open source PHP frameworks on the market. The Symfony Components, however, are loosely coupled projects that can be reused as a library outside of an application based on Symfony. The component this article explores is Console (symfony/console on Packagist and GitHub), dedicated to quickly build console applications.
He goes on to talk about some of the "pros" of using the component (including built-in argument/input handing and multiple "commands") and some of the "cons" of is use (including its size and some of the built-in features you can't really work around).
voice your opinion now!
symfony console reusable component pro con commandline
FuelPHP: Oil Migrations, Tasks and Console (Screencast)
by Chris Cornutt March 15, 2011 @ 11:31:39
Phil Sturgeon has put together a screencast showing off a few of the features of the Fuel PHP framework like migrations, tasks and the console the Oil tool provides.
In this video I'm going to be demonstrating migrations which I touched on in the last video but I felt I should go into them in more depth. Migrations [...] are essentially a way to stage changes for your database in a way that means the changes can be independent from the schema as a whole.
He walks you through the creation of a migration with the help of the Oil command line tool. The generated classes include "up" and "down" methods for the creation and rollback of your changes. He shows the process to create a simple task and how to use the built-in console to interactively work with the framework. You can find out more about Fuel on the Fuel documentation section of the project's site.
voice your opinion now!
fuelphp framework oil console commandline tasks migrations
Sasa Stamenkovic's Blog: Building CLI Apps With Symfony Console Component
by Chris Cornutt December 31, 2010 @ 00:33:58
Sasa Stamenkovic has submitted a new tutorial he's written up about how to build CLI applications in Symfony with the help of its console component.
When working with PHP, I usually use Zend Framework for my projects. It has nice code generation tool (Zend_Tool), MVC, forms, helpers and it's very flexible. But one aspect where Zend wasn't the best tool for the job is building CLI applications. [...] Symfony Console Component is still under development, and there is no good documentation yet. I managed to google out Fabien Potencier's slides from ConFoo 2010 conference where he mentioned the component and showed one simple example. But still, most of the time working with the component, I find myself reading its source code.
He creates a simple console calculator application that takes in two numbers and calculates the sum of the two numbers. He includes an addition to the "--help" menu. Complete code is included to build the CLI interface and to create the class it uses to make the calculation. He shows how to add new commands and a bit on how to test your new command. Complete source code is available on github.
voice your opinion now!
symfony console component commandline tutorial
Liip Blog: Using the Symfony2 console
by Chris Cornutt December 22, 2010 @ 12:02:54
In this recent post from the Liip blog, they talk about using the console functionality that comes with the Symfony2 framework to run bundles from the command line.
Seems at least some people had the same idea as I had, retrieving data from a feed via HTTP GET. So Symfony2 comes up with a nice little wrapper - the console. Unfortunately the documentation on the website only gives a very brief introduction to it Located in the app directory of your project it is ready to be called as soon your Symfony2 installation is ready to be used. Executing it on the command line without an argument it exposes its help page.
He shows you how to get your bundle exposed to the console and a few steps you'll need to do to make it properly executable. He includes a simple "configure()" method you can use to set up a few other things like bundle name, description and arguments to be passed in.
voice your opinion now!
symfony console symfony2 framework tutorial
ServerGrove.com: Creating console commands with Symfony2
by Chris Cornutt October 15, 2010 @ 08:53:19
On the ServerGrove.com blog today there's this new post showing you how to create console commands with your Symfony2 codebase in addition to the normal websites you might have generated.
Symfony 2 is mainly used to create web application, however, sometimes you need to extend your app and need a command line tool to help perform tasks around the application. With symfony 1.4.x these were called tasks and it was possible to create a skeleton by using the symfony generate:task task.
While there's not a tool for it, Symfony2 does offer something called "Commands" as a sort of replacement. A basic skeleton of one is included with the framework, there's just no auto-generation tool for them (yet). The basic one, TestCommand.php, shows you how to set up a command's name, arguments and some parameter mapping. The post includes this code example and how it looks when called from the command line.
voice your opinion now!
console command symfony2 taks commandtest tutorial
Jordi Boggiano's Blog: PHP Console in Your Browser
by Chris Cornutt September 24, 2010 @ 11:51:49
Jordi Boggiano has a new post today looking at his PHP console script that works in your browser that sets up easily and works from your localhost web server - php-console.
Since I spend most of my days programming PHP I tend to need that a lot and a few years back I wrote a small script that would let me type php code in my browser and execute it. Nothing fancy, but quite useful. Over the years a few people got interest seeing me use it and asked for the sources, so instead of repackaging it every time, I thought I'd clean it up, polish a bit, add some features, and put it on github.
Setup is as simple as dropping the code somewhere in your local server's document root and offers a textarea for input and a expandable tree for the resulting output. It uses the Krumo tool to create this modified output. You can see a screenshot here.
voice your opinion now!
console browser interactive shell webbased
Maggie Nelson's Blog: Beyond Error Logs
by Chris Cornutt December 19, 2008 @ 09:34:30
In a new post to her blog Maggie Nelson points out the importance of error logs and a handy tool Zend Framework developers can use to make FirePHP even more useful.
The error log is a standard development support tool. It will help you find problems with your application. When developing, I take extra care to make sure that the error log is clean - this includes warnings and notices as well. When your application gets deployed, you can then depend on the error logs to accurately report any issues. [...] On a recent project, my coworker Matt Purdon wrote a pretty awesome debug console that leverages FirePHP support in Zend Framework to log a lot of information about what the application is doing directly to the Firebug console.
The end result is a console that lets you track things like session variables, memcached information and queries executed in the request (with explain plans). You can see a screenshot here.
voice your opinion now!
error log firephp firebug console zendframework session memcached query
|
Community Events
Don't see your event here? Let us know!
|