So, I thought I'd share something that might benefit those looking for a way to reset opcache in CLI.
As an example in my case, I'm running a Laravel app with a router script with the built-in web server for local development. I enabled opcache with the following run configuration:
/path/to/php.exe -d zend_extension=php_opcache.dll -d opcache.enable_cli=1 -d opcache.memory_consumption=128 -d opcache.max_accelerated_files=10000 -d opcache.validate_timestamps=0 -d opcache.save_comments=0 -t project_path/public/ server.php
This is basically what artisan serve is doing behind the scenes, anyway, except without the opcache part.
I have some file watchers setup to detect changes and executes the following upon said change(s):
/path/to/php.exe -d zend_extension=php_opcache.dll -d opcache.enable_cli=1 -r "opcache_reset();"
The key is ensuring that you're enabling opcache in CLI. I've been using this for some time, so I can attest to this being a viable solution without needing to create a script to execute somewhere in the document root, etc.
I'm only referring to Laravel as an example of why I chose to explore options for solving this problem. This should translate to any scenario a developer would need to utilize opcache in their project(s) while using the built-in web server.