Download the PHP package planetbiru/magic-object without Composer
On this page you can find all versions of the php package planetbiru/magic-object. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package magic-object
MagicObject
Introduction
MagicObject is a powerful library for developing applications in PHP with ease. It enables the dynamic creation of classes for various intended uses. Below are some of its key features:
Features
- Dynamic Object Creation: Easily create objects at runtime.
- Setters and Getters: Simplify property management with automatic methods.
- Multi-Level Objects: Support for nested objects.
- ORM: Object-Relational Mapping support for easier interactions with databases.
- Filtering and Pagination: Built-in methods for managing data display.
- Native Query: Defining native queries for a function will increase flexibility and resource efficiency in accessing the database.
- Multiple Database Connection: MagicObject supports the configuration of multiple database connections, allowing applications to interact with different databases simultaneously.
- Database Dumping: Export database contents efficiently.
- Serialization/Deserialization: Handle JSON and YAML formats seamlessly.
- Data Importing: Import data even if source and destination schemas differ.
- File Reading: Read INI, YAML, and JSON configuration files.
- Environment Variable Access: Easily fetch environment variable values.
- Configuration Encryption: Secure application settings.
- HTTP Data Handling: Create objects from global request variables (POST, GET, etc.).
- Session Management: Integrate with PHP sessions.
- Object Labeling: Enhance object identification.
- Multi-Language Support: Facilitate localization.
- File Uploads: Handle file uploads efficiently.
- Annotations: Add metadata to objects for better structure.
- Debugging: Tools to debug and inspect objects.
This library provides a versatile toolkit for building robust PHP applications!
Installation
Installing MagicObject
To install MagicObject, run:
If Composer is not installed, use:
To remove MagicObject:
Or if Composer is not installed:
Installing Composer
To install Composer on your system or download the latest composer.phar
, visit https://getcomposer.org/download/
To see available versions of MagicObject, visit https://packagist.org/packages/planetbiru/magic-object
Installing MagicObject on PHP 5
This guide walks you through the steps to install MagicObject using Composer on a PHP project, particularly if you're working with a PHP version that might not meet the platform requirements for the package.
Prerequisites:
- PHP installed on your system (PHP 5.x or higher)
- Composer installed globally or locally in your project
Steps to Install MagicObject
1. Navigate to Your Project Directory
Open your terminal and navigate to your PHP project folder:
Make sure you're in the correct directory where your PHP project resides.
2. Install MagicObject Using Composer
Run the following command to require MagicObject in your project:
This command will:
- Add
planetbiru/magic-object
as a dependency to yourcomposer.json
file. - Download and install the MagicObject package into your
vendor/
directory.
3. Update Dependencies with Ignored Platform Requirements
If you're using a PHP version or configuration that doesn't meet the platform requirements specified by MagicObject, you can use the --ignore-platform-reqs
flag to bypass those checks during the installation process:
This command will:
- Update all dependencies listed in
composer.json
. - Ignore platform-specific checks like PHP version or missing extensions, allowing you to proceed with the installation.
4. Autoload Composer in Your PHP Script
After the installation completes, include Composer's autoloader in your PHP scripts to make MagicObject available for use:
This ensures that all your dependencies, including MagicObject, are loaded automatically.
5. Verify Installation
Check that MagicObject is installed by verifying its presence in the vendor
directory:
You should see the MagicObject files in the vendor/planetbiru/magic-object
folder.
6. Start Using MagicObject
You can now start using MagicObject in your PHP application. Example usage:
Replace this with your specific use cases as needed.
Advantages
MagicObject is designed for ease of use and can even be used with a code generator. An example of a code generator that successfully creates MagicObject code using only parameters is MagicAppBuilder. MagicObject offers many flexible ways to write code, allowing users to choose the approach that best suits their needs.
In addition to prioritizing ease of use, MagicObject is also optimized for efficiency in terms of both time and resource usage, enabling applications to run smoothly even on servers with minimal specifications. This reduces costs in both development and operational phases.
Application Scaling
For large applications, MagicObject supports database and storage scaling. You can distribute user access across multiple servers and use Redis for session storage. MagicObject integrates with Redis for cloud-based session storage, which can be secured using a password.
Example
Simple Object
Yaml
Yaml File
Configuration Object
Create class ConfigApp
by extends MagicObject
Entity
Usage
Conclusion
MagicObject is designed to offer ease and speed in creating and managing database entities. Here are several reasons why the methods used by MagicObject can be considered intuitive:
-
Declarative and Annotation-Based:
- By using annotations, MagicObject allows developers to declare entity properties and metadata directly within the code. This makes it easier to understand the structure and relationships of the entities.
-
Easy Integration with Configuration:
- MagicObject can be easily integrated with configuration systems like ConfigApp, making database and development environment setup more straightforward and organized.
-
Automation:
- MagicObject automatically handles many routine tasks, such as CRUD (Create, Read, Update, Delete) operations and table relationships. Developers don’t need to write manual SQL code, reducing the potential for errors.
-
Object-Oriented Approach:
- MagicObject uses an object-oriented approach, allowing developers to work with entities as PHP objects, utilizing methods and properties directly on the entities.
-
Support for Various Data Formats:
- MagicObject can accept data in various formats, including stdClass objects, associative arrays, and form inputs from HTML. This provides flexibility in handling data from different sources.
-
Easy Relationship Management:
- By defining relationships between entities, such as
ManyToOne
andOneToMany
, MagicObject makes it easy to manage complex relationships without needing to write explicit join SQL.
- By defining relationships between entities, such as
-
Automatic Conversion Capabilities:
- MagicObject has the capability to automatically convert objects to JSON, which is extremely useful for APIs and modern web applications.
Tutorial
A tutorial is available here: https://github.com/Planetbiru/MagicObject/blob/main/tutorial.md
Applications Using MagicObject
- Music Production Manager https://github.com/kamshory/MusicProductionManager
- MagicApp https://github.com/Planetbiru/MagicApp
- MagicAppBuilder https://github.com/Planetbiru/MagicAppBuilder
- Koperasi-Simpan-Pinjam-Syariah https://github.com/kamshory/Koperasi-Simpan-Pinjam-Syariah
- Toserba Online https://toserba-online.top/
Credit
- Kamshory - https://github.com/kamshory/
Contributors
- Kamshory - https://github.com/kamshory/