Description
PHP package to make your objects strict and throw exception when you try to access or set some undefined property in your objects.
Yell alternatives and similar libraries
Based on the "Miscellaneous" category.
Alternatively, view Yell alternatives based on common mentions on social networks and blogs.
-
Country List
:globe_with_meridians: List of all countries with names and ISO 3166-1 codes in all languages and data formats. -
Essence
Extracts information about web pages, like youtube videos, twitter statuses or blog articles. -
sabre/vobject
:date: The VObject library for PHP allows you to easily parse and manipulate iCalendar and vCard objects -
Lodash-PHP
Easy to use utility functions for everyday PHP projects. This is a port of the Lodash JS library to PHP -
Embera
A Oembed consumer library, that gives you information about urls. It helps you replace urls to youtube or vimeo for example, with their html embed code. It has advanced features like offline support, responsive embeds and caching support. -
Metrics
Simple library that abstracts different metrics collectors. I find this necessary to have a consistent and simple metrics (functional) API that doesn't cause vendor lock-in. -
ClassPreloader
Optimizes class loading performance by generating a single PHP file containing all of the autoloaded files. -
Cake Utility
[READ-ONLY] CakePHP Utility classes such as Inflector, Text, Hash, Security and Xml. This repo is a split of the main code that can be found in https://github.com/cakephp/cakephp -
RedisSessionHandler
An alternative Redis session handler for PHP featuring per-session locking and session fixation protection
SaaSHub - Software Alternatives and Reviews
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of Yell or a related project?
Popular Comparisons
README
:loudspeaker: Yell
PHP package to make your objects strict and throw exception when you try to access or set some undefined property in your objects.
Requirement
PHP >= 5.4.0.
Installation
You can install the library using the following ways:
Using Composer
You can install this through Composer, a dependency manager for PHP. Just run the below command:
composer require zeeshanu/yell
For further details you can find the package at Packagist.
Manual way
- Copy src to your codebase, perhaps to the vendor directory.
- Add the Zeeshanu\Yell\Scream class to your autoloader or require the file directly.
Getting Started
I'm going to create take an example to demonstrate the usage.
For example, you have a Person
class like below:
class Person
{
public $name;
public $age;
}
$person = new Person();
$person->name = 'John Doe';
$person->age = 23;
// Will silently set the property `profession` on `Person` without any issue
$person->profession = 'Teacher';
Here is how you can make your object strict i.e. not allow any other properties except $name
and $age
and throw exceptions for any other properties. Just use Zeeshanu\Yell\Scream
trait in your class as follows
use Zeeshanu\Yell\Scream;
class Person
{
use Scream;
public $name;
public $age;
}
$person = new Person();
$person->name = 'John Doe';
$person->age = 23;
// An exception will be thrown when showing message "Trying to set undefined property $profession in class Person"
$person->profession = 'Teacher';
Feedback
If you notice that there might be some improvements in code you can create a pull request or report an issue. You can also contact me at [email protected].
License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
*Note that all licence references and agreements mentioned in the Yell README section above
are relevant to that project's source code only.