Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Stefano Alletti:
Symfony and Monolog, how use Processor in your project: a practical example
Mar 17, 2017 @ 17:23:44

Stefano Alletti has written up a post to his site showing how to combine Symfony and Monolog along with a custom "processor" to modify the message and content being logged.

We often have to use different micro-services who write in many log files. Use utilities like Kibana is a good thing, but in order to take full advantage of its features we have to try to standardize and normalize the logs.

The company where I work having introduced Kibana recently, he asked me to implement a proper strategy to log all the micro-services.

He starts by outlining the fields that are required to be in the log output (a great place to start) before moving into the code to implement the logging. He briefly talks about Monolog itself and how to implement it in a Symfony application. The remainder of the post includes the code to implement the logger and how to add the custom processor to modify the extra data being included in the logged data. He also goes a step further and creates a custom formatter to modify the output in the message for the customer ID and product line values.

tagged: tutorial symfony monolog processor formatter integration

Link: https://stefanoalletti.wordpress.com/2017/03/09/symfony-and-monolog-how-use-processor-in-your-project/

DevShed:
The Basics of Implementing Adapter Objects with PHP
Dec 06, 2006 @ 21:53:59

DevShed takes a look at another of the design patterns in a new series starting with this new tutorial - a look at the implementation of Adapter objects in PHP.

You may have already encountered situations in coding PHP applications in which you would like to use inheritance, but could not for one reason or another. Fortunately, there is an alternative for these situations that can help you achieve the same result. In this first article in a two-part series, you'll learn about the adapter pattern.

They start off with the basics of the Adapter pattern and move quickly into the first definition of a class using them - a directory processor. Once that's built, they show how it all works with a more practical example.

tagged: adapter design pattern object tutorial part1 basics directory processor adapter design pattern object tutorial part1 basics directory processor

Link:

DevShed:
The Basics of Implementing Adapter Objects with PHP
Dec 06, 2006 @ 21:53:59

DevShed takes a look at another of the design patterns in a new series starting with this new tutorial - a look at the implementation of Adapter objects in PHP.

You may have already encountered situations in coding PHP applications in which you would like to use inheritance, but could not for one reason or another. Fortunately, there is an alternative for these situations that can help you achieve the same result. In this first article in a two-part series, you'll learn about the adapter pattern.

They start off with the basics of the Adapter pattern and move quickly into the first definition of a class using them - a directory processor. Once that's built, they show how it all works with a more practical example.

tagged: adapter design pattern object tutorial part1 basics directory processor adapter design pattern object tutorial part1 basics directory processor

Link:

DevShed:
Completing a Blogger with PHP
Dec 05, 2006 @ 17:38:00

DevShed caps off another series with this new tutorial today, ending their look at creating a blogging engine in PHP.

Welcome to the concluding installment of the series "Building a blogger with PHP." Made up of three friendly articles, this series provides you with all the information you need to start building a blog system with PHP in a few easy steps.

They look at their blogProcessor class first, including adding the needed database functionality to it. Then it's back out to the client side for the input forms and some validation before adding some style and formatting to the layout of the pages to make it a bit easier to use.

tagged: blogger application engine database processor validation form appearance blogger application engine database processor validation form appearance

Link:

DevShed:
Completing a Blogger with PHP
Dec 05, 2006 @ 17:38:00

DevShed caps off another series with this new tutorial today, ending their look at creating a blogging engine in PHP.

Welcome to the concluding installment of the series "Building a blogger with PHP." Made up of three friendly articles, this series provides you with all the information you need to start building a blog system with PHP in a few easy steps.

They look at their blogProcessor class first, including adding the needed database functionality to it. Then it's back out to the client side for the input forms and some validation before adding some style and formatting to the layout of the pages to make it a bit easier to use.

tagged: blogger application engine database processor validation form appearance blogger application engine database processor validation form appearance

Link:

ZD Net Asia:
Keep your options open with FTP file uploads
Jun 23, 2006 @ 18:51:26

On the ZD Net Asia site today, there's a quick look at using the FTP functionality that can be compiled into PHP to create a method to upload files.

Take file upload, for example. Sure, you can do it the traditional way, using HTTP file upload and transferring the file directly to a location on your Web server's disk. Or you can do it the more exotic way, and use the FTP protocol to upload in a two-step process: from your local disk to a Web server, and then to an FTP server.

Reams have already been written about HTTP file upload, which is why this brief tutorial focuses on FTP-based file uploads instead (in the example that follows, though, you'll see both in action). Note that this tutorial assumes that you have a working PHP/Apache installation, with both HTTP file upload and FTP functions active.

They have three steps for you to take to get their example up and working:

  • checking that you have the access rights to get on the server
  • creating an upload form
  • code the PHP upload processor

The form and PHP code are provided, so there's no reason to worry on that count. The biggest issue is whether or not you have the FTP support compiled into your PHP installation. From there, it's just a few simple function calls away from pushing the uploaded files contents out to a remote server.

tagged: ftp functionality compiledupload tutorial html form processor ftp functionality compiledupload tutorial html form processor

Link:

ZD Net Asia:
Keep your options open with FTP file uploads
Jun 23, 2006 @ 18:51:26

On the ZD Net Asia site today, there's a quick look at using the FTP functionality that can be compiled into PHP to create a method to upload files.

Take file upload, for example. Sure, you can do it the traditional way, using HTTP file upload and transferring the file directly to a location on your Web server's disk. Or you can do it the more exotic way, and use the FTP protocol to upload in a two-step process: from your local disk to a Web server, and then to an FTP server.

Reams have already been written about HTTP file upload, which is why this brief tutorial focuses on FTP-based file uploads instead (in the example that follows, though, you'll see both in action). Note that this tutorial assumes that you have a working PHP/Apache installation, with both HTTP file upload and FTP functions active.

They have three steps for you to take to get their example up and working:

  • checking that you have the access rights to get on the server
  • creating an upload form
  • code the PHP upload processor

The form and PHP code are provided, so there's no reason to worry on that count. The biggest issue is whether or not you have the FTP support compiled into your PHP installation. From there, it's just a few simple function calls away from pushing the uploaded files contents out to a remote server.

tagged: ftp functionality compiledupload tutorial html form processor ftp functionality compiledupload tutorial html form processor

Link:

DevShed:
Completing a Query Processor in PHP
May 31, 2006 @ 19:32:28

DevShed finishes off their "Creating a Query Processor" series, a look at working with sockets and related functions, in part three, a focus on extending the class even further and some more in-depth looks "under the hood".

Welcome to the third part of the series “Network Programming in PHP.” In three tutorials, this series explains the basics of network programming in PHP, by developing a query processor class in PHP 5, which uses some of the most popular PHP network functions, in order to implement the logic of its methods.

In this last article of the series, I'll add some extra methods to the query processor class, which can be used for performing the networking operations that I mentioned before. Of course, I'll implement within all the methods an easy-to-grasp programming logic, so you shouldn't have any problems understanding how each method works.

He starts with a brief look back to see how far the script's come before charging ahead into even more expansion. He fleshes out the getMXRecords and checkDNSRecords methods before adding in come TCP service functions - scanPort and getWhois. Finally, he wraps it all back into the class and takes one last look at the entire creation (and a simple example that checks the DNS and scans ports for the host "google.com".

tagged: query processor network functionality part3 tutorial query processor network functionality part3 tutorial

Link:

DevShed:
Completing a Query Processor in PHP
May 31, 2006 @ 19:32:28

DevShed finishes off their "Creating a Query Processor" series, a look at working with sockets and related functions, in part three, a focus on extending the class even further and some more in-depth looks "under the hood".

Welcome to the third part of the series “Network Programming in PHP.” In three tutorials, this series explains the basics of network programming in PHP, by developing a query processor class in PHP 5, which uses some of the most popular PHP network functions, in order to implement the logic of its methods.

In this last article of the series, I'll add some extra methods to the query processor class, which can be used for performing the networking operations that I mentioned before. Of course, I'll implement within all the methods an easy-to-grasp programming logic, so you shouldn't have any problems understanding how each method works.

He starts with a brief look back to see how far the script's come before charging ahead into even more expansion. He fleshes out the getMXRecords and checkDNSRecords methods before adding in come TCP service functions - scanPort and getWhois. Finally, he wraps it all back into the class and takes one last look at the entire creation (and a simple example that checks the DNS and scans ports for the host "google.com".

tagged: query processor network functionality part3 tutorial query processor network functionality part3 tutorial

Link:

DevShed:
Adding Methods to the Query Processor in PHP
May 24, 2006 @ 17:15:43

DevShed has posted the second part of their "Network Programming in PHP" series today - this time, they enhance the QueryProcessor class they've developed with even more functionality.

At this point I guess that all the networking PHP built-in functions that I covered in the first article, such as the "gethostbyaddr()", "gethostbyname()", "gethostbynamel()" functions are already familiar to you. So now I will explain what new things you'll learn in this second article of the series. Since I want to continue expanding the "QueryProcessor" class that I coded previously, this installment will focus on adding more methods to it, by using other useful PHP network functions, aimed particularly at running popular Windows networking applications, like "ipconfig," "netstat" and more.

If you didn't get a change to check out part one, it's definitely suggested that you do so before you start on this section. As mentioned, they're going to show you how to add other functionality to the class, including the ability to ping another server, check the current machine's network settings, perform a "netstat" command, and get the MX records for a hostname. At the end, they stick it all together in the complete (so far) class for easy cut and paste.

tagged: part2 network functions query processor part2 network functions query processor

Link:


Trending Topics: