I had two very productive weeks. #buildinpublic works wonders.
Most effort went into my new project, Osm Admin. I sketched how data classes look like, generated database tables from class attributes, and started working on the Admin UI. It's very fulfilling to see how an abstract idea gains shape.
It's a package for defining data structures using PHP 8 classes and attributes, and getting fully functioning Admin Panel and API.
Here is how it's going to work.
First, define data classes - regular PHP classes with attributes specifying how instances of these classes are stored in database tables, and displayed in grids and forms of the admin area of your application. For example:
/**
* @@property string $sku #[
* Serialized,
* Table\String_(unique: true),
* Grid\String_('SKU'),
* Form\String_(10, 'SKU'),
* ]
* @@property string $description #[
* Serialized,
* Grid\String_('Description'),
* Form\String_(20, 'Description'),
* ]
*/
#[
Table('products'),
Scoped,
Grid\Page('/products', 'Products', select: ['id', 'sku', 'description']),
Form('/products', title_create: 'New Product', title_edit: ":title - Product"),
]
class Product extends Object_
{
use Id, Type;
}
Then, generate database tables from the #[Table\*] attributes using a command:
osm generate:schema
Finally, open the admin area of your application, and manage the application data using grids and forms automatically created from #[Grid\*] and #[Form\] attributes, respectively.
I document daily progress on this project, challenges I face, and ideas I have, in the blog, on Twitter, on IndieHackers, and on Projectium. If you are interested in this project, please follow and participate.