Releases: leafsphp/leafAPI
⛰ Mountain Aloe '1'
v2.2.1 - ⛰ Mountain Aloe '1' - 16th October, 2021
Added
- Added example schema
Fixed
- Fixed broken migrations
- Fixed broken integrations
Changed
- Updated leaf config
- Updated code to match leaf mvc core
- Switched migrations to static capsule
- Upgraded dependencies
Removed
- Removed unused code
⛰ Mountain Aloe
v2.2.0 - ⛰ Mountain Aloe - 16th October, 2021
Added
- Added example schema
Fixed
- Fixed broken migrations
- Fixed broken integrations
Changed
- Updated leaf config
- Updated code to match leaf mvc core
- Switched migrations to static capsule
- Upgraded dependencies
Removed
- Removed unused code
🌵 Pink Blush Aloe
v2.1 - 🌵 Pink Blush Aloe - 30th April 2021
Added
- Added
app.php
config for easier customization of Leaf - Added route module examples
- Added more shortcut functions
Fixed
- Fixed broken paths
- Updated aloe cli paths
Changed
- Updated core dependencies
- Updated default home page
- Configured leaf api with all Leaf changes to maintain the same API
Removed
- Removed unused code
🌵 Lime Aloe
v2.0 - 🌵 Lime Aloe - 21st February 2021
Added
- Added basic authentication examples to get you going right out of the box
- Added auth config in
Config/auth.php
- Added
auth
,sessionUser
andhasAuth
global methods which allow you to use auth and check a session state - Added views config in
Config/view.php
Fixed
- No fixes made
Changed
- Updated commands to match aloe CLI's syntax
- Updated aloe version
- Updated leaf version
- Updated starter files with new goodies from Leaf
Removed
- Nothing was removed
Aloe (Beta)
🎉 v2.0 - Aloe (Beta)
Version 2 of Leaf API contains a bunch of new features, some inclusions and even some breaking changes which are geared to easy integration with other libraries, as well as bettering some internal features used by Leaf API and Leaf MVC.
NEW IN LEAF API
Aloe CLI
Aloe is a simple but powerful console service that makes building your leaf apps just a simple walk in the park. Aloe CLI ships with the default Leaf console tool in the newer versions of Leaf API. Aloe doesn't just power all commands in your leaf app but also includes a new, simpler and faster way to write your commands.
What this means for the leaf console tool is that a bunch of changes have gone on through the whole system:
NEW FEATURES
Leaf console tool got some new features that enable faster development, better debugging, and better support for console app integration.
Database Install Command
Before, databases would be created manually before linking them to the Leaf application, however now, from the comfort of your console, you can create the database defined in your .env
file if it doesn't already exist.
php leaf db:install
Rollback particular migration
This is a little feature added to allow you rollback particular files instead of rolling back all migrations just to change 1 file. This can be achieved by adding the -f
flag, then the migration to rollback.
Note that only the part of the filename after TIMESTAMP_create_ is required.
php leaf db:rollback -f users
Migrate single file
Since you can rollback a single file, it only makes sense to be able to migrate a single file as well. Just like with with rollback, this can be achieved with the -f
flag followed by the migration.
php leaf db:migrate -f users
Generate Console commands
You can also now generate console commands from the console directly. Leaf doesn't just generate the command file for you, but also registers it in the console, so you can use it right away, amazing right?
php leaf g:command start
This will generate StartCommand
in App\Console
. It's also registered in the console, so right away, you can do:
php leaf start
What of namespaced commands? Not to worry, Leaf is SMART! Just go ahead and do your stuff, Leaf will take care of the rest.
php leaf g:command order:items
Leaf will create the OrderItemsCommand
, add the order namespace in the console and register the command for immediete use. It doesn't get any better. You can also use the filename you want instead of the command.
php leaf g:command ClockCommand
Delete Console Commands
Since you can create, you can delete as well. Leaf Console allows you to delete custom console commands. The command isn't only deleted, but it's also unregistered.
php leaf d:command ClockCommand
# or
php leaf d:command Clock
More detailed console output
Although this is a small one, it's helpful to know exactly what the console tool is working on, as such more readable output messages have been prepared for you.
$ php leaf db:seed
> UsersSeeder seeded successfully
> TableNameSeeder seeded successfully
Database seed complete
FIXES
These group of features are fixes from previous versions. Enjoy!!
Model sub directories
Creating models in subdirectories before created a correct file structure, but a messed up class name, eg:
php leaf g:model Users/Notification
This would create the Notification model in the Users subdirectory, however, the file created would look like this:
class Users/Notification extends Model ...
This has been fixed, also, if the Users subdirectory doesn't exist, it is automatically created.
Working with Seeds
This version also comes with extensive support for database seeds. There are now commands to create and delete seeds, as well as to seed the database with records, courtesy of Mauro Callegari
Create seeds:
$ php leaf g:seed Admins
# or
$ php leaf g:seed AdminsSeeder
Delete:
php leaf d:seed ...
Seed Db
php leaf db:seed
BREAKING CHANGES
A few changes which might need you to tweak your app a little bit. Don't worry, these aren't sharp, disastrous changes, just tweaking one or two lines of code.
Registering console commands
Before, in order to add a new console command, you would just need to head over to the leaf
file in the root directory of your app and add your command, just like the example command.
/*
|--------------------------------------------------------------------------
| Add custom command
|--------------------------------------------------------------------------
|
| If you have a new command to add to Leaf
|
*/
$console->registerCustom(new \App\Console\ExampleCommand());
However, now, Leaf Console supports multiple commands in the form of arrays, so you can now pass an array into registerCustom
, however, the new
keyword is no longer needed, instead, the class instance is passed into registerCustom
.
So the example above will now look like this:
/*
|--------------------------------------------------------------------------
| Add custom command
|--------------------------------------------------------------------------
|
| If you have a new command to add to Leaf
|
*/
$console->registerCustom(\App\Console\ExampleCommand::class);
// multiple commands
$console->registerCustom([
\App\Console\CommandOne::class,
\App\Console\CommandTwo::class
]);
🌱 Working with seeds
Leaf Console tool which initially didn't have a command to run seeds now has included one through Aloe. This change however has added a little twist to the way seeds are defined in Leaf API. Just as before, seeds are created in the App\Database\Seeds
directory but are registered in the DatabaseSeeder
file. In the DatabaseSeeder
, previous versions would need you to call $this->call
to register your own seed files:
public function run()
{
$this->call(UsersSeeder::class);
// if there's more than 1 class
$this->call([
UsersSeeder::class,
TableNameSeeder::class
]);
}
In this version, however, in the run
method, all you need to do is return an array of all the seeds you want to register.
public function run() : array
{
return [
UsersSeeder::class,
TableNameSeeder::class
];
}
New helper methods
Leaf API also got a bunch of new helper methods and directory shortcut methods. Refer to the docs for the full list.
CHANGED IN LEAF API v2
📁 Directory Structure
Routes
Routes were defined in Routes.php
in previous versions, however, for 'scalability' reasons, routes have been grouped in the Routes
directory in which other files can be created to group routes in. An example has already been created which you can refer to.
Stick on fire
v1.2.0 - Stick on Fire [BETA] - 7 July, 2020
Added
- Added global methods:
d()
,dbRow()
,fs()
,email()
,markup()
,plural()
,requestBody()
,requestData()
,respondWithCode()
,sessionBody()
,sessionGet()
,sessionSet()
,singular()
,throwErr()
- Added example controller + route
- Added model examples for resource controllers
- Added controller name autocompletion on Leaf Console
- Added
.env
init insideindex.php
Changed
- Renamed global method
App()
toapp()
- Renamed global method
View()
toview()
- Slashed unnecessary code on previous global methods
- Updated required packages versions
Removed
- Removed unnecessary npm stuff
- Removed unused console files
- Removed UI Presets
Marie Bracey
v1.1.0 - Marie Bracey - 30 June, 2020
Added
- Added App config
- Added default CORS bypass
- Added shortcut functions
Changed
- Corrected all instances of
Leaf\Core\Database
toLeaf\Database
- Updated all packages
- Updated app version in terminal
- Corrected casing for directory names in paths config
Removed
- Removed useless commands in console
- Removed "useless" config files
- Removed unused UI presets
Camellia
Leaf API Rewrite - 27 May, 2020
Changed
- Updated Leaf Framework to LR(v2.1.0-alpha)
- Changed composer package to
leafs/api
- Added full MVC support