<p>There are multiple libraries and extensions available for this tasks.</p>

<p><strong>Extensions</strong></p>

<p>Stem</p>

<ul>
<li><a href="https://pecl.php.net/package/stem" rel="nofollow">https://pecl.php.net/package/stem</a></li>
<li><a href="http://snowball.tartarus.org/" rel="nofollow">http://snowball.tartarus.org/</a> (<a href="http://snowball.tartarus.org/demo.php" rel="nofollow">DEMO</a>)</li>
</ul>

<p>php-stemmer</p>

<p><a href="https://github.com/hthetiot/php-stemmer" rel="nofollow">https://github.com/hthetiot/php-stemmer</a></p>

<p><strong>Libraries</strong></p>

<p>These Porter-Stemmer libs will also do the job (at least for the english language parts):  </p>

<ul>
<li><a href="https://github.com/andyceo/PHP-Porter-Stemmer" rel="nofollow">https://github.com/andyceo/PHP-Porter-Stemmer</a></li>
<li><a href="http://www.chuggnutt.com/stemmer" rel="nofollow">http://www.chuggnutt.com/stemmer</a></li>
</ul>

<p>PHP Morhpy</p>

<p><a href="http://phpmorphy.sourceforge.net/dokuwiki/" rel="nofollow">http://phpmorphy.sourceforge.net/dokuwiki/</a></p>

<p>--</p>

<p>Urdu is a mixed language. So the "basic" Porter-Stemming will not be enough (and might only be sufficent for the english language parts of Urdu). You will have to model the language rules. The Urdu language is really challenging for NLP, because of the rich morphology. </p>

<p>If you want to implement a rule based stemmer, then take a look at this paper, which explains the algo used: "<a href="http://arxiv.org/ftp/arxiv/papers/1310/1310.0581.pdf" rel="nofollow">Rule Based Stemmer in Urdu</a>" by Vaishali Gupta, Nisheeth Joshi
, Iti Mathur.</p>
How to build Urdu stemming library in PHP?
<p>There are lot of stemming libraries but they are in other languages but I need an API or library or algorithm that will be use for stemming Urdu words. I want to find the root of a word like in English e.g.</p>

<blockquote>
  <p>sadness => sad</p>
</blockquote>