/devworx

PHP Framework for fast prototyping

Primary LanguagePHP

Devworx RP

PHP framework for rapid prototyping

This structure facilitates other developers to quickly get into the project and efficiently create prototypes.

No 3rd Party PHP Libraries are used.

The software can be customized and extended as desired, as it is intended to save developers time.

Inspiration

As a developer, I wrote the same codes over and over. I repeated the same time-consuming steps for prototype development. Sure, I could have used bigger frameworks like Typo3 (big inspiration for me), because of future compatibility and ability to handle big Web-Projects with ease. But for small prototypes, Typo3 is just too big. Devworx is my personal interpreation of a framework, that was shaped over more than 20 years of development. It might not be perfect, but it will grow.

Roadmap

The solution will be expanded and supplemented with functionality over time. Here are some ideas:

  • Find a better solution name, because Devworx is taken...
  • L10n Integration
  • Better Renderer
  • XML and JSON Utilities
  • Dynamic alias-based query building
  • Editors for models, menus and users
  • User groups and permission management
  • PSR integration

Over time, more repositories will be released that are based on Devworx.

Want to participate?

Feel free to submit changes and be part of the project. I will revise the code and create branches for upcoming changes.

Architecture

Context-Based MVC Solution

The solution can be controlled in the frontend and API context via controllers and actions. The LoginHash can be provided by Cookie or via request header.

Credential Hashing

The LoginHash consists of the login name and password. Neither the login name nor the password are stored in plaintext in the database. The hash is directly compared with the value in the database.

Database

The Database class serves as a database interface and is accessible via global $DB.

Database entries in Devworx have a basic structure that allows for easy data handling and mapping to any AbstractModel.

  • uid PK int (Unique ID of the row)
  • cruser int (UserID of the creation user)
  • created timestamp (Creation timestamp)
  • updated timestamp (Timestamp of last update)
  • hidden tinyint (Hidden-Flag)
  • deleted tinyint (Deleted-Flag)

Repository

The Repository class enables caching of schemas. System fields such as hidden and deleted are automatically added to the queries.

Data Handling

The results of database queries are generally represented with associative arrays. Classes like ArrayWalker allow enriching relational data such as MySQL results to enable multidimensional results and additional data. Models can also be used to modify result handling.

Templating

The solution uses the principle of layout, template, and partial. The layout provides the outer frame that is the same for all results and renders the corresponding template of the requested action. Partials are small code snippets that can be used in templates and layouts, as well as in the actions, to generate output.

Rendering

The rendering is done via AbstractRenderer. The FluidRenderer enables string templating with placeholders. The JSON-Renderer allows direct output in JSON. ViewHelpers are (yet) not available.

Resources

A distinction is made between private and public resources. Private resources are, for example, layouts, templates, and partials. Public are all styles, images, icons, and scripts.

Configuration

The solution can be configured via JSON files, that are stored in the Configuration folder.

Styling

Bootstrap 5.3 and Material Icons from Google are used here.

Custom HTML Elements

The solution contains its own HTML elements to handle lists and formats. These are imported via JavaScript module.

Caches

The solution features automatic file caching of MySQL database schemas. This allows type usage without database queries.

Advantages

Modularity

The class structure makes it easy to find and change specific functions.

Reusability

Through inheritance and utility classes, many parts of the code can be reused, which shortens development time.

Clarity

The division into different classes and files helps to keep the code clear.

Extensibility

New functions can be easily implemented by adding new classes or inheriting existing classes.

Error Handling

Utility classes such as DebugUtility and ErrorUtility make implementing debugging and error handling logic easier.

Security Features

AuthUtility provides basic security functions that can be quickly integrated.