Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ImWaller's avatar

Composer install package question

I have a package on packagist with the name "example". My question there any way to use composer like npx?

example: composer example and composer run execution of binary

0 likes
3 replies
automica's avatar

@imwaller not exactly.

Composer is used to manage installation and updating of vendor packages, and these are all php packages.

Any packages than contain runnable binaries will be accessible via vendor/bin/ directory. An example of this would be phpunit and you’d run that via the following command

./vendor/bin/phpunit 

You can define commands and scripts for composer within your project by adding to the scripts section of your composer.Json

See https://getcomposer.org/doc/articles/scripts.md#calling-composer-commands

ImWaller's avatar
ImWaller
OP
Best Answer
Level 1

Thanks for the reply @automica Composer cant do the same think as npx that I was looking for...

automica's avatar

yeah. thats what I meant by 'not exactly'.

Please or to participate in this conversation.