Passing a variable from a foreach loop into a snippet

Projects template loop:

<ul>
    <?php foreach ($articles as $project): ?>
        <li class="card" data-aos="fade-up" value="<?php snippet('filtervalues') ?>">
        </li>
    <?php endforeach ?>
</ul>

The snippet :

<?= $project->value()->toStructure()->name() ?>

I can’t use the $project variable in the snippet. Is there a way to pass this variable into the snippet? I want to keep the projects-page clean because I need to add multiple field values in the value attribute.

I solved it in the meantime…
for those who jump into the same question: