<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>TrishulAPI Q&amp;A - Recent questions and answers in Request</title>
<link>https://trishulapi.com/forum/qa/request</link>
<description>Powered by Question2Answer</description>
<item>
<title>Answered: How to get the query params of url in Trishul API?</title>
<link>https://trishulapi.com/forum/10/how-to-get-the-query-params-of-url-in-trishul-api?show=11#a11</link>
<description>Welcome Developers, &lt;br /&gt;
&lt;br /&gt;
In this situation, a class QueryParam.php is there which consists many useful methods for getting and checking the query params. &lt;br /&gt;
&lt;br /&gt;
You can get the instance of query-params from request object. &lt;br /&gt;
&lt;br /&gt;
$user_id = $request-&amp;gt;query_params()-&amp;gt;get(&amp;#039;user_id);&lt;br /&gt;
&lt;br /&gt;
If user_id query param doesn&amp;#039;t exist in url it will return null. &lt;br /&gt;
&lt;br /&gt;
Same way you can get the query params from any url. &lt;br /&gt;
&lt;br /&gt;
Read this:- &lt;a href=&quot;https://trishulapi.com/docs/v1x/Http/Request.php&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;https://trishulapi.com/docs/v1x/Http/Request.php&lt;/a&gt;</description>
<category>Request</category>
<guid isPermaLink="true">https://trishulapi.com/forum/10/how-to-get-the-query-params-of-url-in-trishul-api?show=11#a11</guid>
<pubDate>Tue, 24 Jun 2025 08:19:51 +0000</pubDate>
</item>
<item>
<title>Answered: How to get the path variables in Trishul API?</title>
<link>https://trishulapi.com/forum/7/how-to-get-the-path-variables-in-trishul-api?show=8#a8</link>
<description>Hi developers, as all of us know that whenever we work on any restful backend. We have to deal with the path variables for example&lt;br /&gt;
&lt;br /&gt;
/user/{username}&lt;br /&gt;
&lt;br /&gt;
We have created this endpoint to provide the user data to client after getting the username value from the client.&lt;br /&gt;
&lt;br /&gt;
This endpoint provides the user data to the client. It takes one path variable username and then fetches the data from database and returns to the client.&lt;br /&gt;
&lt;br /&gt;
In Trishul API, you can get this path variable from the $request object.&lt;br /&gt;
&lt;br /&gt;
$username = $request-&amp;gt;path()-&amp;gt;get(&amp;#039;username&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
That&amp;#039;s it. You will get the $username from the path variable and pass it to your logic.</description>
<category>Request</category>
<guid isPermaLink="true">https://trishulapi.com/forum/7/how-to-get-the-path-variables-in-trishul-api?show=8#a8</guid>
<pubDate>Tue, 24 Jun 2025 03:15:20 +0000</pubDate>
</item>
</channel>
</rss>