CoderFunda
  • Home
  • About us
    • Contact Us
    • Disclaimer
    • Privacy Policy
    • About us
  • Home
  • Php
  • HTML
  • CSS
  • JavaScript
    • JavaScript
    • Jquery
    • JqueryUI
    • Stock
  • SQL
  • Vue.Js
  • Python
  • Wordpress
  • C++
    • C++
    • C
  • Laravel
    • Laravel
      • Overview
      • Namespaces
      • Middleware
      • Routing
      • Configuration
      • Application Structure
      • Installation
    • Overview
  • DBMS
    • DBMS
      • PL/SQL
      • SQLite
      • MongoDB
      • Cassandra
      • MySQL
      • Oracle
      • CouchDB
      • Neo4j
      • DB2
      • Quiz
    • Overview
  • Entertainment
    • TV Series Update
    • Movie Review
    • Movie Review
  • More
    • Vue. Js
    • Php Question
    • Php Interview Question
    • Laravel Interview Question
    • SQL Interview Question
    • IAS Interview Question
    • PCS Interview Question
    • Technology
    • Other

17 August, 2022

Build APIs in Laravel With the Restify Package

 Programing Coderfunda     August 17, 2022     Laravel, Packages     No comments   

 Laravel Restify is a package to make a powerful JSON:API-compatible Rest API with Laravel. After installing the package and following the setup guide, you can get started quickly using the repository CLI:

1php artisan restify:repository Dream --all

The repository is the core of this package. The example command above would generate a blank repository that you could add fields to, like the following example:

1namespace App\Restify;
2 
3use App\Models\Dream;
4use Binaryk\LaravelRestify\Http\Requests\RestifyRequest;
5 
6class DreamRepository extends Repository
7{
8 public static string $model = Dream::class;
9 
10 public function fields(RestifyRequest $request): array
11 {
12 return [
13 id(),
14 field('title')->required(),
15 field('description'),
16 field('image')->image(),
17 ];
18 }
19}

If you don't define the $model property, Restify can guess based on the repository class name (i.e., DreamRepository would be the Dream model).

Here's an example of the built-in UserRepository class (you would want to protect this in a real app) that will return an API response in JSON API format:

1GET: /api/restify/users?perPage=10&page=2
2{
3 "meta": {
4 "current_page": 1,
5 "from": 1,
6 "last_page": 1,
7 "path": "http://localhost:8000/api/restify/users",
8 "per_page": 15,
9 "to": 1,
10 "total": 1
11 },
12 "links": {
13 "first": "http://localhost:8000/api/restify/users?page=1",
14 "next": null,
15 "path": "http://localhost:8000/api/restify/users",
16 "prev": null,
17 "filters": "/api/restify/users/filters"
18 },
19 "data": [
20 {
21 "id": "1",
22 "type": "users",
23 "attributes": {
24 "name": "Paul Redmond",
25 "email": "paul@example.com"
26 }
27 }
28 ]
29}

This package also walks you through the authentication process, advanced filtering, and more!

Learn More

To get started, I recommend watching the Restify Course, which has 24 lessons on using Restify to build an API with Laravel. You can also read the official documentation to install this package and start using it in your applications. Finally, you can see the source code and contribute on GitHub at BinarCode/laravel-restify.

Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Profile Your Laravel Application With Xhprof

 Programing Coderfunda     August 17, 2022     Laravel, Packages     No comments   

 The laravel-xhprof package makes it easy to use Xhprof to profile your laravel application. This package includes profiling for your web application routes and the Artisan console.

XHProf is a function-level hierarchical profiler for PHP and has a simple HTML based navigational interface. The raw data collection component is implemented in C (as a PHP extension). The reporting/UI layer is all in PHP. It is capable of reporting function-level inclusive and exclusive wall times, memory usage, CPU times and number of calls for each function. Additionally, it supports ability to compare two runs (hierarchical DIFF reports), or aggregate results from multiple runs.

Along with the Laravel side of this package that will trace your requests when XHPROF_ENABLED=true in your .env file, you can visualize the profiling with XHGUI, which uses a database backend, and pretty graphs to make it easy to use and interpret:

The laravel-xhprof GitHub repo has all the instructions you need to set up the XHProf PHP module, the GUI, database configuration, and more.

Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Newer Posts Older Posts Home

Meta

Popular Posts

  • CSS Box Model
    All HTML elements can be considered as boxes. In CSS, the term "box model" is used when talking about design and layout. The CSS b...
  • CSS Borders
    CSS Border Properties The CSS  border  properties allow you to specify the style, width, and color of an element's border. I have...
  • SQL UPDATE Statement
      The SQL UPDATE Statement The UPDATE statement is used to modify the existing records in a table. UPDATE Syntax UPDATE   table_name SET   c...
  • Python Tutorial
      Python Tutorial Python tutorial provides basic and advanced concepts of Python. Our Python tutorial is designed for beginners and professi...
  • Laravel Vapor application observability with Inspector
    An extended tutorial on integrating Inspector observability platform to monitor your Laravel application deployed with Vapor. The post La...

Categories

  • Ajax (26)
  • Bootstrap (30)
  • DBMS (42)
  • HTML (12)
  • HTML5 (45)
  • JavaScript (10)
  • Jquery (34)
  • Jquery UI (2)
  • JqueryUI (32)
  • Laravel (1017)
  • Laravel Tutorials (23)
  • Laravel-Question (6)
  • Magento (9)
  • Magento 2 (95)
  • MariaDB (1)
  • MySql Tutorial (2)
  • PHP-Interview-Questions (3)
  • Php Question (13)
  • Python (36)
  • RDBMS (13)
  • SQL Tutorial (79)
  • Vue.js Tutorial (69)
  • Wordpress (150)
  • Wordpress Theme (3)
  • codeigniter (108)
  • oops (4)
  • php (853)

Social Media Links

  • Follow on Twitter
  • Like on Facebook
  • Subscribe on Youtube
  • Follow on Instagram

Pages

  • Home
  • Contact Us
  • Privacy Policy
  • About us

Blog Archive

  • July (4)
  • September (100)
  • August (50)
  • July (56)
  • June (46)
  • May (59)
  • April (50)
  • March (60)
  • February (42)
  • January (53)
  • December (58)
  • November (61)
  • October (39)
  • September (36)
  • August (36)
  • July (34)
  • June (34)
  • May (36)
  • April (29)
  • March (82)
  • February (1)
  • January (8)
  • December (14)
  • November (41)
  • October (13)
  • September (5)
  • August (48)
  • July (9)
  • June (6)
  • May (119)
  • April (259)
  • March (122)
  • February (368)
  • January (33)
  • October (2)
  • July (11)
  • June (29)
  • May (25)
  • April (168)
  • March (93)
  • February (60)
  • January (28)
  • December (195)
  • November (24)
  • October (40)
  • September (55)
  • August (6)
  • July (48)
  • May (2)
  • January (2)
  • July (6)
  • June (6)
  • February (17)
  • January (69)
  • December (122)
  • November (56)
  • October (92)
  • September (76)
  • August (6)

Loading...

Laravel News

Loading...

Copyright © CoderFunda | Powered by Blogger
Design by Coderfunda | Blogger Theme by Coderfunda | Distributed By Coderfunda