News: 2021 Oct 25 - Nov 5
1 year ago ∙ 2 minutes read
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.
More details:
Osm Admin v0.1.0
Introduction
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.
E-commerce Sample Application
In order to test this attribute-based data management engine, I simultaneously develop a sample e-commerce application. So far, it has modules for user, product and sales order management, but surely, there is more to come.
What's Done So Far
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.
Recap:
I started generating the Admin UI, but it's really too raw yet.
Osm Framework v0.13.13
What's new in this minor update:
- Customize new default page title settings.
- Use new
_admin__tailwind
theme as a base admin area theme. - Use new
$osm_app->area_url
instead of$osm_app->base_url
for generating URLs in the current area. - Register routes with parameters in a dynamic trait, see
HttpModuleTrait
andRoutes
in the Osm Admin project for more details.
osm.software Website v0.4.2
In this new minor update, I've added Osm Admin to the home page, and reorganized all the blocks on the home page. I've also blogged about Osm Admin development.
Osm Core v0.10.4
This minor update contains:
- New
AttributeRequired
exception. Throw it if you expect a class or a property to have certain PHP attribute applied. - New
module_class_name
reflection property. It specifies the module that introduced a given class or property.