Troubleshooting

Common issues and solutions when working with Stilmark Base.

Installation Issues

Composer Installation Fails

Problem: composer require stilmark/base fails with dependency conflicts.

Solution:

# Update Composer first
composer self-update

# Clear Composer cache
composer clear-cache

# Try installation with verbose output
composer require stilmark/base -v

PHP Version Compatibility

Problem: "Your PHP version (X.X.X) does not satisfy requirement php ^8.2"

Solution:

  • Ensure you're running PHP 8.2 or higher

  • Check your PHP version: php -v

  • Update PHP through your system package manager or use a version manager like phpbrew

Missing Extensions

Problem: Class 'Symfony\Component\Dotenv\Dotenv' not found or OAuth functionality not working.

Solution:

Runtime Issues

Environment Variables Not Loading

Problem: Env::get() returns null or default values.

Solutions:

  1. Check .env file exists and is readable

  2. Verify file path in Env::load() call

  3. Ensure no syntax errors in .env file

Routing Issues

Problem: Routes not matching or 404 errors.

Solutions:

  1. Check route definitions syntax

  2. Verify controller namespace and method exist

  3. Ensure proper URL rewriting (Apache/Nginx)

OAuth Authentication Fails

Problem: Google OAuth returns errors or fails silently.

Solutions:

  1. Verify Google OAuth credentials in .env

  2. Check redirect URI matches Google Console settings

  3. Ensure HTTPS in production

Session Issues

Problem: Sessions not persisting or authentication middleware failing.

Solutions:

  1. Ensure sessions are started before using Auth

  2. Check session configuration

  3. Verify session storage permissions

Performance Issues

Slow Route Resolution

Problem: Application responds slowly on route matching.

Solutions:

  1. Enable route caching in production

  2. Optimize route definitions order

  3. Use FastRoute's caching features

Memory Usage

Problem: High memory consumption.

Solutions:

  1. Profile memory usage with Xdebug

  2. Optimize large data processing

  3. Use streaming for large responses

Development Tips

Debugging

Enable detailed error reporting during development:

Logging

Use the built-in Logger for debugging:

Testing Routes

Create a simple test script:

Getting Help

If you're still experiencing issues:

  1. Create a minimal reproduction case

  2. Submit a new issue with:

    • PHP version

    • Stilmark Base version

    • Error messages

    • Minimal code example

Last updated