New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

dkx/private-properties-accessor

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dkx/private-properties-accessor

Accessor for private properties without reflection

Source
Packagist
This package is abandoned and is no longer maintained.
The author recommends using true instead.
This version has been yanked by its maintainers and should not be used.
Version
0.1.0
Version published
Total downloads
523
Maintainers
1
Created
Source

DKX/PrivatePropertiesAccessor

Accessor for private properties without reflection

Based on https://ocramius.github.io/blog/accessing-private-php-class-members-without-reflection/

Installation

$ composer require dkx/private-properties-accessor

Usage

<?php

declare(strict_types=1);

use DKX\PrivatePropertiesAccessor\PrivatePropertiesAccessor;

$accessor = new PrivatePropertiesAccessor($class);
$prop = & $accessor->getProperty('propFromClass');
$prop = 'hello world';

var_dump($class->propFromClass);    // output: hello world

Get all properties

<?php

$props = $accessor->getProperties();

This method uses get_object_vars function which means that it will not return parent private properties.

FAQs

Package last updated on 23 Aug 2019

Related posts