Hey there! 👋 Welcome to Forge Starter – think of this as your super lightweight starting kit for building web apps with the Forge PHP framework. It's got just the essentials to get you going quickly, so your project stays nice and lean.
Forge Starter comes with a couple of cool things pre-installed:
- ForgePackageManager: This is the Forge package manager itself! You'll use this to easily add and manage any extra modules you want in your project.
- ForgeErrorHandler: This helps you handle errors and exceptions like a pro. During development, it'll show you helpful error pages, and in production, it'll make sure things fail gracefully.
- ForgeWelcome: This is the welcome page that you see when you run this project.
- ForgeUi: This is the forge component ui that the ForgeWelcome use.
This minimal setup means your project starts super small (under 400KB!). It's perfect if you're all about speed, simplicity, and knowing exactly what's going on in your code, after you are done checking how the modules works, you can remove the module that you dont need, for example the ForgeWelcome, ForgeUi, etc, if you dont need to have a more human friendly error handler, just remove it, if you dont want a package manager cli remove it.
Getting started with Forge Starter is a piece of cake:
-
Grab a copy of this project:
git clone [repository-url] your-project-name cd your-project-name(Just replace
[repository-url]with the actual link to this Forge Starter repository, andyour-project-namewith whatever you want to name your project folder.) -
Install the basics using ForgePackageManager:
php install.php php forge.php package:install-project
This command will look at the
forge.lock.jsonfile (orforge.jsonif it's a brand new project) and install the main Forge framework bits and any modules listed in yourforge.jsonfile. This gets your project set up with the core of Forge and the stuff that comes with the starter. -
Tweak your settings:
- Environment stuff: Copy the
.env.examplefile to.envand open up.envto set things like your database info and your website's URL. - Make it secure (optional, but a good idea!):
(This command creates a unique key for your app and puts it in your
php forge.php key:generate
.envfile. It's especially important for security when your site goes live.)
- Environment stuff: Copy the
-
See your app in action (for testing): You can use Forge's built-in mini-server:
php forge.php serve
This will start a little server for you, usually at
http://localhost:8080. You can even change the address and port if you want:php forge.php serve 127.0.0.1 9090
That'll make it run at
http://127.0.0.1:9090.Or, if you prefer, you can use PHP's own built-in server directly:
php -S localhost:8000 -t public
Then just open your browser and go to
http://localhost:8000.
One of the cool things about Forge is that it's super modular. You can easily add more features to your Forge Starter project by installing extra modules using the ForgePackageManager.
To add a new module, just run this command:
php forge.php package:install-module module-name@[module-version](Replace [module-name] with the name of the Forge module you want to install, e.g., forge package:require ForgeDatabaseModule. You can find a list of available modules at the Forge Modules Repository.)
The Forge command-line tool has a bunch of useful commands to help you manage your project:
| Command | Description |
|---|---|
php forge.php package-install:module <name> |
Install a module |
php forge.php package:remove-module <name> |
Remove a module |
php forge.php package:list-modules |
Show installed modules |
php forge.php clear:cache |
Clears the cache views, classes |
php forge.php clear:log |
Clears the logs |
php forge.php make:module |
Creates a new Forge module with a basic directory structure |
- You can always see the full list of available commands and their descriptions by running:
php forge.php helpForge Engine, Modules, Starter are open-source software licensed under the MIT license.