How to start?
Getting started with yesFramework is very simple and quick. Please download the latest version of a package
here . Pack consists of the following files and folders
The content to be copied in such a way that the
public directory equal to a directory in which files are located by default web page to the user. Then call your web site. You'll see your home page.
Done! You installed and launched yesFramework!
What now?
For a start, locate the
.env file in the root directory and
config.php in the
src/yesFramework/Core folder. These are the configuration files where you enter basic configuration data, such as the environment, database connection details, and other essential settings. Proper implementation of these data is necessary for the proper operation of the framework. You'll notice the framework uses a modern OOP structure and routing. Check the
public/index.php to see how routes are registered and then look into
WelcomeController.php in
src/yesFramework/App/Controllers/. This file is responsible for the home page you see after calling the website.
Check this file to find out how
yesFramework supports models and controllers.
Add new controller
Controllers are classes that handle routes. To add a new controller, create a PHP class in
src/yesFramework/App/Controllers/. Then, register it using the Router in
public/index.php:
$router->get('/your-path', [YourController::class, 'methodName']);
Calling
www.example.com/your-path will invoke the `methodName` of your controller. yesFramework supports static routes and dynamic parameters, such as
/user/{id}.
Add View
To load a selected view, the controller must enter the following line:
Base::load_view('template_name.php ', 'content_name.php ', $data_to_body);
The
$data_to_body is an array of elements that will be injected into the file
template_name.php and
content_name.php, which is located in the
App/Views .
Example
$data_to_body = array(
"header" => "example header",
"data_from_class" => $data_from_class,
"footer" => "example footer"
);
Base::load_view('template.php', 'content.php', $data_to_body);
In
template.php i content.php will arise variables named
$header, data_from_class and
$footer that will contain values from the array.
Summary
I encourage you to read through the documentation with examples
here . I hope this quick start is quite understandable.