<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Marvelous Akpotu</title>
    <description>The latest articles on DEV Community by Marvelous Akpotu (@marvelxy).</description>
    <link>https://dev.to/marvelxy</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F226998%2F10024092-2cef-4352-9975-d6fae1b1ba29.jpeg</url>
      <title>DEV Community: Marvelous Akpotu</title>
      <link>https://dev.to/marvelxy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/marvelxy"/>
    <language>en</language>
    <item>
      <title>Scraping a Website Using a Symfony Console Command (Clean &amp; Production-Friendly)</title>
      <dc:creator>Marvelous Akpotu</dc:creator>
      <pubDate>Wed, 25 Feb 2026 17:48:35 +0000</pubDate>
      <link>https://dev.to/marvelxy/scraping-a-website-using-a-symfony-console-command-clean-production-friendly-5f2e</link>
      <guid>https://dev.to/marvelxy/scraping-a-website-using-a-symfony-console-command-clean-production-friendly-5f2e</guid>
      <description>&lt;p&gt;Web scraping doesn’t belong in controllers.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It’s long-running.&lt;/li&gt;
&lt;li&gt;It may fail.&lt;/li&gt;
&lt;li&gt;It’s often scheduled.&lt;/li&gt;
&lt;li&gt;It’s automation.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That’s exactly why Symfony Console Commands are perfect for it.&lt;/p&gt;

&lt;p&gt;Symfony Console Commands allow you to create custom CLI tasks that run inside your Symfony application with full access to its services and dependency injection container. They are ideal for the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Background jobs&lt;/li&gt;
&lt;li&gt;Automation&lt;/li&gt;
&lt;li&gt;Data processing&lt;/li&gt;
&lt;li&gt;Any long-running operations that shouldn’t live inside controllers.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In this article, we’ll:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Scrape country data&lt;/li&gt;
&lt;li&gt;Parse HTML with DomCrawler&lt;/li&gt;
&lt;li&gt;Sort results&lt;/li&gt;
&lt;li&gt;Display a clean CLI table&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is the GitHub repo to follow along: &lt;a href="https://github.com/Marvelxy/symfony-web-scraper" rel="noopener noreferrer"&gt;https://github.com/Marvelxy/symfony-web-scraper&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We’ll use a free scraping sandbox from &lt;a href="http://www.scrapethissite.com" rel="noopener noreferrer"&gt;www.scrapethissite.com&lt;/a&gt; :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.scrapethissite.com/pages/simple/" rel="noopener noreferrer"&gt;https://www.scrapethissite.com/pages/simple/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Required Packages
&lt;/h2&gt;

&lt;p&gt;If you don't already have them:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;composer require symfony/http-client
composer require symfony/dom-crawler
composer require symfony/css-selector
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Create the Command
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php bin/console make:command app:create-countries
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, let’s focus only on the parts that matter.&lt;/p&gt;

&lt;h2&gt;
  
  
  Inject the HttpClient
&lt;/h2&gt;

&lt;p&gt;Instead of manually creating a client, inject it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Symfony\Contracts\HttpClient\HttpClientInterface&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;__construct&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="kt"&gt;HttpClientInterface&lt;/span&gt; &lt;span class="nv"&gt;$client&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Clean, testable, and native Symfony DI.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fetch the Page
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;request&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'GET'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;self&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;URL&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nv"&gt;$html&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$response&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;getContent&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This gives us the raw HTML.&lt;/p&gt;

&lt;h2&gt;
  
  
  Parse with DomCrawler
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Symfony\Component\DomCrawler\Crawler&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nv"&gt;$crawler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Crawler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$html&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, we can extract the block of each country:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$countryInfo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;

&lt;span class="nv"&gt;$crawler&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'.country'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nb"&gt;each&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;Crawler&lt;/span&gt; &lt;span class="nv"&gt;$row&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nv"&gt;$countryInfo&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nv"&gt;$countryInfo&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="nv"&gt;$row&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'.country-name'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;text&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
        &lt;span class="nv"&gt;$row&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'.country-capital'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;text&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
        &lt;span class="nv"&gt;$row&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'.country-population'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;text&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
        &lt;span class="nv"&gt;$row&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'.country-area'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;text&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you’ve used JavaScript’s querySelectorAll(), this will feel familiar.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sort the countries alphabetically
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nb"&gt;usort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$countryInfo&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;strcasecmp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$a&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="nv"&gt;$b&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Format Output Like a Pro
&lt;/h2&gt;

&lt;p&gt;Instead of dumping raw arrays, format the output properly in a table&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nb"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s2"&gt;"%-45s | %-20s | %15s | %15s&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"Country name"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"Capital"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"Population"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"Area (km2)"&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then loop through the results and print them.&lt;/p&gt;

&lt;p&gt;You can also add a small multibyte-safe padding helper to ensure alignment works even with Unicode characters.&lt;/p&gt;

&lt;p&gt;The result looks like a professional terminal table instead of debug output.&lt;/p&gt;

&lt;h2&gt;
  
  
  Run It
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php bin/console app:create-countries
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see an output similar to this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faimkquqhoj5n58rzndb7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faimkquqhoj5n58rzndb7.png" alt="Command output in table format" width="800" height="502"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Use a Symfony Command for Scraping?
&lt;/h2&gt;

&lt;p&gt;Because it gives you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Separation of concerns&lt;/li&gt;
&lt;li&gt;Cron scheduling capability&lt;/li&gt;
&lt;li&gt;Clean architecture&lt;/li&gt;
&lt;li&gt;Reusability&lt;/li&gt;
&lt;li&gt;Easy refactoring into async jobs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is how scraping should be structured in real applications, not inside controllers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Production Tips
&lt;/h2&gt;

&lt;p&gt;Before scraping real websites:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Check Terms of Service&lt;/li&gt;
&lt;li&gt;Respect robots.txt&lt;/li&gt;
&lt;li&gt;Avoid aggressive request rates&lt;/li&gt;
&lt;li&gt;Add delays if scraping multiple pages. Example:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nb"&gt;sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Full Source Code&lt;/p&gt;

&lt;p&gt;I’ve published the complete working project on GitHub, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The full command implementation&lt;/li&gt;
&lt;li&gt;Proper formatting helpers&lt;/li&gt;
&lt;li&gt;Setup instructions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;GitHub repo: &lt;a href="https://github.com/Marvelxy/symfony-web-scraper" rel="noopener noreferrer"&gt;https://github.com/Marvelxy/symfony-web-scraper&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Symfony + Console Commands + DomCrawler is an underrated combination.&lt;/p&gt;

&lt;p&gt;If you’re building:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Data aggregation tools&lt;/li&gt;
&lt;li&gt;Monitoring systems&lt;/li&gt;
&lt;li&gt;Intelligence platforms&lt;/li&gt;
&lt;li&gt;Background automation jobs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This pattern scales cleanly and keeps your application architecture solid.&lt;/p&gt;

&lt;p&gt;In part 2, I will store the result in the database.&lt;/p&gt;

</description>
      <category>php</category>
      <category>symfony</category>
      <category>webscraping</category>
    </item>
    <item>
      <title>Install PHP AMQP Extension on Mac</title>
      <dc:creator>Marvelous Akpotu</dc:creator>
      <pubDate>Sun, 13 Feb 2022 14:37:20 +0000</pubDate>
      <link>https://dev.to/marvelxy/install-php-amqp-extension-on-mac-4ahd</link>
      <guid>https://dev.to/marvelxy/install-php-amqp-extension-on-mac-4ahd</guid>
      <description>&lt;p&gt;I spent several hours trying to set up &lt;strong&gt;PHP&lt;/strong&gt; &lt;strong&gt;amqp&lt;/strong&gt; extension on mac. When I finally got it to work, I created this post as a reference for myself in the future, and also to assist anyone trying to install it.&lt;/p&gt;

&lt;p&gt;First, follow the usual steps to install rabbitmq from the URL: &lt;br&gt;
&lt;a href="https://rabbitmq.com/install-homebrew.html" rel="noopener noreferrer"&gt;https://rabbitmq.com/install-homebrew.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After installing rabbitmq and adding it to your path, you can then follow these steps found in this URL:&lt;br&gt;
&lt;a href="https://blog.karatos.in/a?ID=00850-2e534416-7a8d-4bce-b77c-ea946f63e10c" rel="noopener noreferrer"&gt;https://blog.karatos.in/a?ID=00850-2e534416-7a8d-4bce-b77c-ea946f63e10c&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The steps below are similar to the ones in the above URL, however, I had to modify it to make it work in my case.&lt;/p&gt;

&lt;p&gt;Download the latest version of AMQP or any version of your choice from this URL: &lt;a href="https://pecl.php.net/package/amqp" rel="noopener noreferrer"&gt;https://pecl.php.net/package/amqp&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Extract the zipped file and visit it on your terminal.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cd/Users/***/Downloads/amqp-&amp;lt;VERSION&amp;gt;/amqp-&amp;lt;VERSION&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ phpize
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ ./configure -with-php-config=/opt/homebrew/bin/php-config --with-amqp --with-librabbitmq-dir=/opt/homebrew/Cellar/rabbitmq-c/&amp;lt;VERSION&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In my case, I ran the previous command with version 0.11.0 as seen below:&lt;br&gt;
./configure -with-php-config=/opt/homebrew/bin/php-config --with-amqp --with-librabbitmq-dir=/opt/homebrew/Cellar/rabbitmq-c/0.11.0&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Run the following commands&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ make
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ make test
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ make install
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it. amqp should be installed by now. Next, you have to add the extension to your PHP configuration.&lt;/p&gt;

&lt;p&gt;Open the php.ini file at &lt;strong&gt;/opt/homebrew/etc/php/8.1/php.ini&lt;/strong&gt;, if the extension have been added (extension="amqp.so"), remove it and create ext-amqp.ini in the folder /opt/homebrew/etc/php/8.1/conf.d and add the following content:&lt;/p&gt;

&lt;p&gt;[ampq]&lt;br&gt;
extension="amqp.so"&lt;/p&gt;

&lt;p&gt;Save the file and restart php.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ brew services restart php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, check if it amqp is installed successfully:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ php -i|grep amqp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Happy hacking 🚀&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;References&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://stackoverflow.com/questions/51818515/installing-amqp-on-mac-with-brew/69653679#69653679" rel="noopener noreferrer"&gt;https://stackoverflow.com/questions/51818515/installing-amqp-on-mac-with-brew/69653679#69653679&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="http://kasanova.nl/posts/enable-amqp-in-php" rel="noopener noreferrer"&gt;http://kasanova.nl/posts/enable-amqp-in-php&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://rabbitmq.com/install-homebrew.html" rel="noopener noreferrer"&gt;https://rabbitmq.com/install-homebrew.html&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://blog.karatos.in/a?ID=00850-2e534416-7a8d-4bce-b77c-ea946f63e10c" rel="noopener noreferrer"&gt;https://blog.karatos.in/a?ID=00850-2e534416-7a8d-4bce-b77c-ea946f63e10c&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://pecl.php.net/package/amqp" rel="noopener noreferrer"&gt;https://pecl.php.net/package/amqp&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>php</category>
      <category>pecl</category>
      <category>macos</category>
      <category>homebrew</category>
    </item>
  </channel>
</rss>
