# How can I access my plugin's snippet from a PHP class?

**URL:** <https://forum.shopware.com/t/how-can-i-access-my-plugins-snippet-from-a-php-class/65494>\
**Category:** Programming (EN)\
**Created:** [13. März 2020 um 14:01 UTC](https://forum.shopware.com/t/how-can-i-access-my-plugins-snippet-from-a-php-class/65494 "2020-03-13T14:01:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![huzaifa\_zepcom](https://avatars.discourse-cdn.com/v4/letter/h/5f8ce5/32.png) [@huzaifa\_zepcom](https://forum.shopware.com/u/huzaifa_zepcom)\
**Post date:** [13. März 2020 um 14:01 UTC](https://forum.shopware.com/t/how-can-i-access-my-plugins-snippet-from-a-php-class/65494/1 "2020-03-13T14:01:34Z")

</div>

I know how to access the snippet in the twig, but how can I do that from the PHP class? We had a way of accessing any snippet from the namespace in SW5, but I am lost how do to achieve the same for SW6.&nbsp;

Any help is appreciated.&nbsp;

---

<div class="post-metadata">

**Author:** ![Almare](https://avatars.discourse-cdn.com/v4/letter/a/a87d85/32.png) [@Almare](https://forum.shopware.com/u/Almare)\
**Post date:** [1. April 2020 um 19:44 UTC](https://forum.shopware.com/t/how-can-i-access-my-plugins-snippet-from-a-php-class/65494/2 "2020-04-01T19:44:56Z")

</div>

Use the symfony trannslator as dependency of your service or class and access your snippet like this example.

$label = $this-\>translator-\>trans(‘your-label’);
