<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>PHP Archives - Belchamber Web Tools &amp; Code</title>
	<atom:link href="https://tools.belchamber.us/code-snippets/php/feed/" rel="self" type="application/rss+xml" />
	<link>https://tools.belchamber.us/code-snippets/php/</link>
	<description>Free Web Tools, Code Snippets, Tutorials and Conversions</description>
	<lastBuildDate>Sat, 23 Aug 2025 09:38:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>
<site xmlns="com-wordpress:feed-additions:1">99928718</site>	<item>
		<title>Converting .png and .jpg Images to .webp Can Improve Your Site Performance with This Free PHP Script</title>
		<link>https://tools.belchamber.us/converting-png-and-jpg-images-to-webp-can-improve-your-site-performance-with-this-free-php-script/</link>
					<comments>https://tools.belchamber.us/converting-png-and-jpg-images-to-webp-can-improve-your-site-performance-with-this-free-php-script/#respond</comments>
		
		<dc:creator><![CDATA[Aaron Belchamber]]></dc:creator>
		<pubDate>Sat, 23 Aug 2025 09:38:13 +0000</pubDate>
				<category><![CDATA[Images]]></category>
		<category><![CDATA[PHP]]></category>
		<guid isPermaLink="false">https://tools.belchamber.us/?p=1430</guid>

					<description><![CDATA[<p>Converting .png and .jpg Images to .webp Can Improve Your Site Performance with This Free PHP Script</p>
<p>The post <a href="https://tools.belchamber.us/converting-png-and-jpg-images-to-webp-can-improve-your-site-performance-with-this-free-php-script/">Converting .png and .jpg Images to .webp Can Improve Your Site Performance with This Free PHP Script</a> appeared first on <a href="https://tools.belchamber.us">Belchamber Web Tools &amp; Code</a>.</p>
]]></description>
		
					<wfw:commentRss>https://tools.belchamber.us/converting-png-and-jpg-images-to-webp-can-improve-your-site-performance-with-this-free-php-script/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1430</post-id>	</item>
		<item>
		<title>Rendering Twig templates from Symfony Repository without Using Dependency Injection (DIC)</title>
		<link>https://tools.belchamber.us/rendering-twig-templates-from-symfony-repository-without-using-dependency-injection-dic/</link>
					<comments>https://tools.belchamber.us/rendering-twig-templates-from-symfony-repository-without-using-dependency-injection-dic/#respond</comments>
		
		<dc:creator><![CDATA[Aaron Belchamber]]></dc:creator>
		<pubDate>Thu, 04 Jul 2019 17:25:09 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[Twig & Doctrine]]></category>
		<guid isPermaLink="false">https://tools.belchamber.us/?p=1171</guid>

					<description><![CDATA[<p>Sometimes it&#8217;s useful to access Twig templates from a Symfony repository, one could argue that this goes against a repository&#8217;s role, but if you think of Twig template files or Twig strings perhaps grabbed from a database as data, then this coincides nicely with the function of a repo. These arguments aside, whatever your situation, [&#8230;]</p>
<p>The post <a href="https://tools.belchamber.us/rendering-twig-templates-from-symfony-repository-without-using-dependency-injection-dic/">Rendering Twig templates from Symfony Repository without Using Dependency Injection (DIC)</a> appeared first on <a href="https://tools.belchamber.us">Belchamber Web Tools &amp; Code</a>.</p>
]]></description>
		
					<wfw:commentRss>https://tools.belchamber.us/rendering-twig-templates-from-symfony-repository-without-using-dependency-injection-dic/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1171</post-id>	</item>
		<item>
		<title>PHP: Checking if a form was posted with &#8220;REQUEST_METHOD&#8221; server global</title>
		<link>https://tools.belchamber.us/php-checking-if-a-form-was-posted/</link>
					<comments>https://tools.belchamber.us/php-checking-if-a-form-was-posted/#respond</comments>
		
		<dc:creator><![CDATA[Aaron Belchamber]]></dc:creator>
		<pubDate>Mon, 28 Dec 2015 16:19:56 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<guid isPermaLink="false">https://tools.belchamber.us/?p=983</guid>

					<description><![CDATA[<p>Something so simple, let&#8217;s say even in a framework like Symfony which I use all the time you want to just check to see if the incoming request was initiated by an actual form post.&#160; Here&#8217;s the best way to check: I implement this switch in a lot of handlers where I deploy API clients [&#8230;]</p>
<p>The post <a href="https://tools.belchamber.us/php-checking-if-a-form-was-posted/">PHP: Checking if a form was posted with &#8220;REQUEST_METHOD&#8221; server global</a> appeared first on <a href="https://tools.belchamber.us">Belchamber Web Tools &amp; Code</a>.</p>
]]></description>
		
					<wfw:commentRss>https://tools.belchamber.us/php-checking-if-a-form-was-posted/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">983</post-id>	</item>
		<item>
		<title>General API interface with CURL: A simple way to access most APIs &#8212; use as is or extend as necessary</title>
		<link>https://tools.belchamber.us/general-api-interface-with-curl-a-simple-way-to-access-most-apis-use-as-is-or-extend-as-necessary/</link>
					<comments>https://tools.belchamber.us/general-api-interface-with-curl-a-simple-way-to-access-most-apis-use-as-is-or-extend-as-necessary/#respond</comments>
		
		<dc:creator><![CDATA[Aaron Belchamber]]></dc:creator>
		<pubDate>Sat, 26 Dec 2015 15:43:53 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[API tips]]></category>
		<category><![CDATA[php code]]></category>
		<guid isPermaLink="false">https://tools.belchamber.us/?p=979</guid>

					<description><![CDATA[<p>Since you likely interface with a lot of external APIs, there&#8217;s no need to keep rewriting the same tool.  Just copy this and use the &#8220;apiBaseController&#8221; class as you need it.  It&#8217;s a good, clean way to start any API accessing project! &#60;?php /** * Class apiBaseController * * Any access of APIs outside of [&#8230;]</p>
<p>The post <a href="https://tools.belchamber.us/general-api-interface-with-curl-a-simple-way-to-access-most-apis-use-as-is-or-extend-as-necessary/">General API interface with CURL: A simple way to access most APIs &#8212; use as is or extend as necessary</a> appeared first on <a href="https://tools.belchamber.us">Belchamber Web Tools &amp; Code</a>.</p>
]]></description>
		
					<wfw:commentRss>https://tools.belchamber.us/general-api-interface-with-curl-a-simple-way-to-access-most-apis-use-as-is-or-extend-as-necessary/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">979</post-id>	</item>
		<item>
		<title>PHP Developers:  Pre-made state pulldown lists for HTML forms</title>
		<link>https://tools.belchamber.us/962-2/</link>
					<comments>https://tools.belchamber.us/962-2/#respond</comments>
		
		<dc:creator><![CDATA[Aaron Belchamber]]></dc:creator>
		<pubDate>Sat, 28 Nov 2015 15:15:11 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[html forms]]></category>
		<category><![CDATA[php tips]]></category>
		<category><![CDATA[symfony]]></category>
		<guid isPermaLink="false">http://tools.belchamber.us/?p=962</guid>

					<description><![CDATA[<p>I like to reuse code as much as possible and if there&#8217;s underyling data in something I&#8217;ll use again, I&#8217;ll put that data in some extractable form in an EAV (Entity, Attribute, Value) database table so I don&#8217;t need to maintain the data anywhere except one place. So in the example below where the variable [&#8230;]</p>
<p>The post <a href="https://tools.belchamber.us/962-2/">PHP Developers:  Pre-made state pulldown lists for HTML forms</a> appeared first on <a href="https://tools.belchamber.us">Belchamber Web Tools &amp; Code</a>.</p>
]]></description>
		
					<wfw:commentRss>https://tools.belchamber.us/962-2/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">962</post-id>	</item>
		<item>
		<title>ZIP and password protect any file with simple script using PHP</title>
		<link>https://tools.belchamber.us/zip-and-password-protect-any-file-with-simple-script-using-php/</link>
					<comments>https://tools.belchamber.us/zip-and-password-protect-any-file-with-simple-script-using-php/#respond</comments>
		
		<dc:creator><![CDATA[Aaron Belchamber]]></dc:creator>
		<pubDate>Fri, 17 Apr 2015 14:31:17 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[php snippets]]></category>
		<category><![CDATA[php tips]]></category>
		<category><![CDATA[zip archive]]></category>
		<guid isPermaLink="false">http://tools.belchamber.us/?p=774</guid>

					<description><![CDATA[<p>You may need to password protect a file before sending it to someone.  Yes, there are Windows utilities, some free, that do this but I found this script works surprisingly well as long as &#8220;zip&#8221; is installed on your server. Just simply save the following file below to your website then upload the file you [&#8230;]</p>
<p>The post <a href="https://tools.belchamber.us/zip-and-password-protect-any-file-with-simple-script-using-php/">ZIP and password protect any file with simple script using PHP</a> appeared first on <a href="https://tools.belchamber.us">Belchamber Web Tools &amp; Code</a>.</p>
]]></description>
		
					<wfw:commentRss>https://tools.belchamber.us/zip-and-password-protect-any-file-with-simple-script-using-php/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">774</post-id>	</item>
		<item>
		<title>PHP cleaning strings with &#8220;preg_replace()&#8221; function and more resources for REGEX</title>
		<link>https://tools.belchamber.us/php-cleaning-strings-preg_replace-function-resources-regex/</link>
					<comments>https://tools.belchamber.us/php-cleaning-strings-preg_replace-function-resources-regex/#respond</comments>
		
		<dc:creator><![CDATA[Aaron Belchamber]]></dc:creator>
		<pubDate>Sat, 20 Sep 2014 16:12:17 +0000</pubDate>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[PHP]]></category>
		<guid isPermaLink="false">http://tools.belchamber.us/?p=568</guid>

					<description><![CDATA[<p>Cleaning strings by removing anything that is not a letter or number can be very useful, like building clean URLs based on customer data. This will replace anything that isn’t a letter, number or space. Then, you can further clean the spaces by replacing with dashes (&#8220;-&#8220;) for better URL readability. $stringToClean = preg_replace("/[^a-zA-Z 0-9]+/", [&#8230;]</p>
<p>The post <a href="https://tools.belchamber.us/php-cleaning-strings-preg_replace-function-resources-regex/">PHP cleaning strings with &#8220;preg_replace()&#8221; function and more resources for REGEX</a> appeared first on <a href="https://tools.belchamber.us">Belchamber Web Tools &amp; Code</a>.</p>
]]></description>
		
					<wfw:commentRss>https://tools.belchamber.us/php-cleaning-strings-preg_replace-function-resources-regex/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">568</post-id>	</item>
		<item>
		<title>Typical way to send CURL POST data in PHP</title>
		<link>https://tools.belchamber.us/typical-way-to-send-curl-post-data-in-php/</link>
					<comments>https://tools.belchamber.us/typical-way-to-send-curl-post-data-in-php/#respond</comments>
		
		<dc:creator><![CDATA[Aaron Belchamber]]></dc:creator>
		<pubDate>Fri, 19 Sep 2014 11:47:24 +0000</pubDate>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[PHP]]></category>
		<guid isPermaLink="false">http://tools.belchamber.us/?p=452</guid>

					<description><![CDATA[<p>Here is a typical way to send PHP data to another script and have that data returned via CURL POST. Keep in mind there are a lot of server security restrictions that may impede CURL from working properly. Visit the PHP cURL book to learn more. function curlPost ($url,$valsArr) { //create name / value pairs [&#8230;]</p>
<p>The post <a href="https://tools.belchamber.us/typical-way-to-send-curl-post-data-in-php/">Typical way to send CURL POST data in PHP</a> appeared first on <a href="https://tools.belchamber.us">Belchamber Web Tools &amp; Code</a>.</p>
]]></description>
		
					<wfw:commentRss>https://tools.belchamber.us/typical-way-to-send-curl-post-data-in-php/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">452</post-id>	</item>
		<item>
		<title>The basic way to work with file attachments for users to download files via hyperlinks in PHP</title>
		<link>https://tools.belchamber.us/the-basic-way-to-work-with-file-attachments-for-users-to-download-files-via-hyperlinks-in-php/</link>
					<comments>https://tools.belchamber.us/the-basic-way-to-work-with-file-attachments-for-users-to-download-files-via-hyperlinks-in-php/#respond</comments>
		
		<dc:creator><![CDATA[Aaron Belchamber]]></dc:creator>
		<pubDate>Fri, 05 Sep 2014 10:23:55 +0000</pubDate>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[PHP]]></category>
		<guid isPermaLink="false">http://tools.belchamber.us/?p=508</guid>

					<description><![CDATA[<p>This is always something that seems to be overcomplicated, if you generate PDFs or other files and use some form of AJAX to call that file, how do you force the user&#8217;s browser to treat the link as an attachment for them to save on their computer? You have to make sure the script hasn&#8217;t [&#8230;]</p>
<p>The post <a href="https://tools.belchamber.us/the-basic-way-to-work-with-file-attachments-for-users-to-download-files-via-hyperlinks-in-php/">The basic way to work with file attachments for users to download files via hyperlinks in PHP</a> appeared first on <a href="https://tools.belchamber.us">Belchamber Web Tools &amp; Code</a>.</p>
]]></description>
		
					<wfw:commentRss>https://tools.belchamber.us/the-basic-way-to-work-with-file-attachments-for-users-to-download-files-via-hyperlinks-in-php/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">508</post-id>	</item>
		<item>
		<title>Mysql PDO standard insert (persist) of data to a table with placeholders to protect from MySQL injection attacks</title>
		<link>https://tools.belchamber.us/mysql-pdo-standard-insert-persist-of-data-to-a-table-with-placeholders-to-protect-from-mysql-injection-attacks/</link>
					<comments>https://tools.belchamber.us/mysql-pdo-standard-insert-persist-of-data-to-a-table-with-placeholders-to-protect-from-mysql-injection-attacks/#respond</comments>
		
		<dc:creator><![CDATA[Aaron Belchamber]]></dc:creator>
		<pubDate>Wed, 02 Jul 2014 18:52:29 +0000</pubDate>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<guid isPermaLink="false">http://tools.belchamber.us/?p=331</guid>

					<description><![CDATA[<p>This is a much more secure way to insert records and prevent MySQL injection.  This assumes that $this-conn is your MySQLi PDO database connection object that you&#8217;ve already initialized:</p>
<p>The post <a href="https://tools.belchamber.us/mysql-pdo-standard-insert-persist-of-data-to-a-table-with-placeholders-to-protect-from-mysql-injection-attacks/">Mysql PDO standard insert (persist) of data to a table with placeholders to protect from MySQL injection attacks</a> appeared first on <a href="https://tools.belchamber.us">Belchamber Web Tools &amp; Code</a>.</p>
]]></description>
		
					<wfw:commentRss>https://tools.belchamber.us/mysql-pdo-standard-insert-persist-of-data-to-a-table-with-placeholders-to-protect-from-mysql-injection-attacks/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">331</post-id>	</item>
	</channel>
</rss>
