https://github.com/osmphp/admin
A package for defining data structures using PHP 8 classes and attributes, and getting fully functioning Admin Panel and API.
https://github.com/osmphp/admin
Last synced: 12 months ago
JSON representation
A package for defining data structures using PHP 8 classes and attributes, and getting fully functioning Admin Panel and API.
- Host: GitHub
- URL: https://github.com/osmphp/admin
- Owner: osmphp
- License: gpl-3.0
- Created: 2021-10-21T07:48:52.000Z (over 4 years ago)
- Default Branch: v0.3
- Last Pushed: 2022-07-23T21:35:51.000Z (over 3 years ago)
- Last Synced: 2025-03-26T02:34:59.217Z (about 1 year ago)
- Language: PHP
- Homepage: https://osm.software/blog/data/
- Size: 4.06 MB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
Osm Admin is a framework for defining database tables using PHP classes and having a user-friendly admin panel for managing data out of the box.
The ultimate goal to is for you to stop worrying about all the admin panel details of your application, and spend all your efforts on what actually matter to *your* users.
Currently, it's in active development. The rest of the document is written in present tense, but most of it is yet to be implemented.
## Prerequisites
* [PHP 8.1 or later](https://www.php.net/manual/en/install.php), and enable `curl`, `fileinfo`, `intl`, `mbstring`, `openssl`, `pdo_mysql`, `pdo_sqlite`, `sqlite3`
extensions
* [MySql 8.0 or later](https://dev.mysql.com/downloads/)
* [Node.js, the latest LTS version](https://nodejs.org/en/download/current/)
* [Gulp 4 command line utility](https://gulpjs.com/docs/en/getting-started/quick-start#install-the-gulp-command-line-utility)
* [ElasticSearch 7.14 or later](https://www.elastic.co/downloads/elasticsearch)
* [Osm Framework command line aliases](https://osm.software/blog/21/08/framework-command-line-aliases.html)
## Getting Started
1. Create a project:
composer create-project osmphp/admin-project project1
2. Create MySql database, for example `project1`. Avoid `_` and `-` symbols in the name.
3. In the project directory, create `.env.Osm_App` file. On Linux, use `bin/create-env.sh` command to create it from a template:
NAME=... # same as MySql database name
#PRODUCTION=true
MYSQL_DATABASE="${NAME}"
MYSQL_USERNAME=...
MYSQL_PASSWORD=...
SEARCH_INDEX_PREFIX="${NAME}_"
4. Install the project. On Linux, run `bin/install.sh` in the project directory. On other platforms, run the following commands:
# go to project directory
cd project1
# compile the applications
osmc Osm_Admin_Samples
osmc Osm_Project
osmc Osm_Tools
# collect JS dependencies from all installed modules
osmt config:npm
# install JS dependencies
npm install
# build JS, CSS and other assets
gulp
# make `temp` directory writable
find temp -type d -exec chmod 777 {} \;
find temp -type f -exec chmod 666 {} \;
# create tables in the MySql database
osm migrate:up --fresh
5. Create and enable a [Nginx virtual host](https://osm.software/docs/framework/0.15/getting-started/web-server.html#nginx), for example, `project1.local`.
osmt config:nginx --prevent_network_access
sudo php vendor/osmphp/framework/bin/tools.php config:host
sudo php vendor/osmphp/framework/bin/tools.php install:nginx
6. In a separate command line window, keep Gulp running, it will clear the cache and rebuild assets as needed:
cd project1
gulp && gulp watch
7. Define a data class:
# src/Welcome/Product.php
.
7. Instead of `osm` command-line alias, use `php bin/run.php`, for example:
php bin/run.php refresh
php bin/run.php migrate:up --fresh
8. In a separate command line window, keep Gulp running, it will clear the cache and rebuild assets as needed:
cd {project_dir}
gulp && gulp watch
### Points Of Interest
After the project is up and running, put the project under debugger, try various operations in the browser, and in the command line, using `osm` command alias.
To better understand what's going on under the hood, put breakpoints in main entry points:
* In the `run()` methods of route (or controller) classes, located in the `src/Ui/Routes/Admin` directory.
* In the `run()` methods of command line commands, located in the `src/Schema/Commands` directory.
### Read Framework Docs
This project is based on Osm Framework. To better understand how and why this project is written, read [the documentation](https://osm.software/docs/framework/0.15/index.html) of Osm Framework.
### Join Chats
Finally, with all the questions and ideas, join the chats on [Discord](https://discord.gg/EfW4nXPj).