PHPackages                             bugraozkan/json-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. bugraozkan/json-php

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

bugraozkan/json-php
===================

It allows you to create a PHP object and convert it to json.

1.0.1(1y ago)24MITPHPPHP &gt;=7.0

Since Dec 15Pushed 1y ago2 watchersCompare

[ Source](https://github.com/bugraozkan/json-php)[ Packagist](https://packagist.org/packages/bugraozkan/json-php)[ RSS](/packages/bugraozkan-json-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

Compiling JSON with PHP
=======================

[](#compiling-json-with-php)

This library simplifies the `json_encode` function, making it easier to generate and send JSON responses in PHP.

Installation
------------

[](#installation)

Install the library via Composer:

```
composer require bugraozkan/json-php
```

Include the autoloader in your project:

```
require 'vendor/autoload.php';
```

Features
--------

[](#features)

- **Easy:** Simplified API for creating and sending JSON responses.
- **Quick:** Built on PHP's `json_encode` for fast performance.
- **Secure:** Automatically sets appropriate HTTP headers.
- **Flexible:** Supports adding objects, properties, or arrays dynamically.
- **Configurable:** Allows customization of JSON encoding options.
- **Compatible:** Works seamlessly with JSONP and jQuery.

**Note:** Objects are optimized to leverage JSON's inherent object representation.

Usage Example
-------------

[](#usage-example)

```
