One method I have seen programmers (including myself) use to keep folks out of private libraries / include modules is to put a check in there.
Easiest example:
in index.php (or any script with permission to be called directly), this line, immediately after the “