Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leaf MVC Core v4.x #23

Draft
wants to merge 29 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
2205dfc
feat: add config for data
mychidarko Dec 11, 2024
671b1a0
feat: add wip schema parser
mychidarko Dec 11, 2024
3ba9029
feat: remove all deprecated stuff
mychidarko Dec 11, 2024
190ef03
chore: update readme
mychidarko Dec 18, 2024
3664f6f
fix: patch up csrf enabled
mychidarko Dec 18, 2024
a88471e
feat: update model relationships in schema
mychidarko Dec 22, 2024
64ce238
fix: patch up schema db connection
mychidarko Dec 22, 2024
be76f77
feat: automatically load all libraries if lib folder exists
mychidarko Dec 22, 2024
ce4403c
feat: add db sync and app index support
mychidarko Dec 22, 2024
7d11c37
fix: return null on missing config
mychidarko Dec 22, 2024
3102bda
feat: add billing init
mychidarko Dec 30, 2024
e9f9948
feat: switch leaf db to deferred connection
mychidarko Jan 10, 2025
fad3bdb
feat: add seeding support
mychidarko Jan 10, 2025
ac8efe8
feat: add support for db reset
mychidarko Jan 10, 2025
c1f6b03
feat: add rollback support
mychidarko Jan 10, 2025
878d42a
chore: update version
mychidarko Jan 20, 2025
615612c
fix: install leaf db
mychidarko Jan 20, 2025
bea4963
fix: patch up mail publish not working
mychidarko Jan 25, 2025
03ab09c
chore: remove unused files
mychidarko Jan 25, 2025
4b2700f
feat: switch to connect to match new API
mychidarko Feb 8, 2025
ebd5c76
feat: change config loading to increase performance
mychidarko Feb 10, 2025
e2d8436
fix: update to use new config API
mychidarko Feb 10, 2025
f1eeaed
feat: automatically set up queue config and commands
mychidarko Feb 18, 2025
96d559f
chore: update db version
mychidarko Feb 19, 2025
15ded18
feat: automatically setup redis if available
mychidarko Feb 20, 2025
c8639af
feat: sync db to eloquent config
mychidarko Feb 20, 2025
22198c7
feat: add support for web/API modes
mychidarko Feb 23, 2025
508a860
chore: update version
mychidarko Feb 28, 2025
feee645
feat: add special cases to schema diff
mychidarko Mar 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
[![Total Downloads](https://poser.pugx.org/leafs/mvc-core/downloads)](https://packagist.org/packages/leafs/mvc-core)
[![License](https://poser.pugx.org/leafs/mvc-core/license)](https://packagist.org/packages/leafs/mvc-core)

This is the heart of Leaf MVC. It serves as a bridge between Leaf and the MVC file structure. It provides a ton of functionality that makes it easy to build a full-blown MVC application with Leaf.
Leaf MVC Core is the heart of Leaf MVC and serves as bridge between Leaf, modules and the MVC file structure. It provides a ton of extra functionality like extra globals, classes and methods that help with separation of concerns and building a full-blown MVC application with Leaf.

## 📦 Installation

Expand All @@ -32,12 +32,9 @@ composer require leafs/mvc-core
MVC Core comes with:

- Controllers
- Api Controllers
- Database & Models
- Factories
- Models
- Schemas
- Database & Model functionalities
- Tons of MVC and module globals
- Autoloading directory files

Since you don't use this package on its own, the documentation is covered in the [Leaf MVC documentation](https://leafphp.dev/docs/mvc/).

Expand Down
9 changes: 7 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,17 @@
]
},
"minimum-stability": "dev",
"prefer-stable": true,
"prefer-stable": true,
"require": {
"leafs/leaf": "*",
"doctrine/dbal": "^3.2",
"vlucas/phpdotenv": "^5.4",
"illuminate/database": "^8.75",
"illuminate/events": "^8.75"
"illuminate/events": "^8.75",
"symfony/yaml": "^6.4",
"leafs/db": "*"
},
"require-dev": {
"fakerphp/faker": "^1.24"
}
}
49 changes: 1 addition & 48 deletions src/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,54 +66,7 @@ public function id()
*/
public function view(string $view, array $data = [])
{
/// WILL REFACTOR IN NEXT VERSION

if (is_object($data)) {
$data = (array) $data;
}

if (ViewConfig('render')) {
if (ViewConfig('config')) {
call_user_func_array(ViewConfig('config'), [[
'views' => AppConfig('views.path'),
'cache' => AppConfig('views.cachePath'),
]]);
}

return ViewConfig('render')($view, $data);
}

$engine = ViewConfig('viewEngine');
$className = strtolower(get_class(new $engine));

$fullName = explode('\\', $className);
$className = $fullName[count($fullName) - 1];

if (\Leaf\Config::getStatic("views.$className")) {
if (ViewConfig('config')) {
call_user_func_array(ViewConfig('config'), [[
'views' => AppConfig('views.path'),
'cache' => AppConfig('views.cachePath'),
]]);
} else {
\Leaf\Config::get("views.$className")->configure(AppConfig('views.path'), AppConfig('views.cachePath'));
}

return \Leaf\Config::get("views.$className")->render($view, $data);
}

$engine = new $engine($engine);

if (ViewConfig('config')) {
call_user_func_array(ViewConfig('config'), [[
'views' => AppConfig('views.path'),
'cache' => AppConfig('views.cachePath'),
]]);
} else {
$engine->config(AppConfig('views.path'), AppConfig('views.cachePath'));
}

return $engine->render($view, $data);
return view($view, $data);
}

/**
Expand Down
Loading