System requirements
Before installing S-PHP, ensure your system meets these requirements:PHP version
PHP 8.1 or higher is required
Extensions
ext-mbstring and ext-pdo must be enabledWeb server
Apache, Nginx, or use PHP’s built-in server
Composer
Required for autoloading and dependency management
Verify PHP installation
Check your PHP version and installed extensions:If you don’t have PHP 8.1 or higher, visit php.net to download and install the latest version.
Installation steps
Clone the repository
Clone the S-PHP repository to your local machine:This will create a new directory called
S-PHP with all the framework files.Install dependencies
Use Composer to install the required dependencies and set up autoloading:This command will:
- Install all required packages
- Generate the
vendor/autoload.phpfile - Set up PSR-4 autoloading for your application
Configure environment (optional)
If your project includes a Edit the
.env.example file, copy it to .env and configure your environment variables:.env file to configure your database connection and other settings.Run migrations (optional)
If you’re using a database, run the migrations to set up your database schema:
Start the development server
Use the built-in CLI command to start PHP’s development server:This will start the server on
http://localhost:8000.The
php do up command runs PHP’s built-in server from the public directory, which is the recommended entry point for your application.Project structure
After installation, your project directory will look like this:Web server configuration
Apache
If you’re using Apache, ensure you have a.htaccess file in the public directory with the following configuration:
Nginx
For Nginx, add this configuration to your server block:Troubleshooting
Port 8000 is already in use
Port 8000 is already in use
If port 8000 is already in use, you can specify a different port:
Autoloader error: Unable to load class
Autoloader error: Unable to load class
This error usually means Composer’s autoloader isn’t set up correctly. Run:
PDO extension not found
PDO extension not found
Install the PDO extension for your PHP version:
Next steps
Quick start guide
Learn how to build your first S-PHP application with our quick start guide.