PHP Interview Questions(14)



最近的项目中有使用 Laravel 吗?Laravel 的目录结构。


With the best of your knowledge, create 2 Apis as following: 

1 - Endpoint: /mail/contact

Description: This endpoint is used to send contact form to a specific email, It needs to use the SMTP server provided to dispatch the email to the target user, the email must include Name, Email, Message, and optionally an Attachment

Required Payload: 

   name: String,
   email: String,
   message: String,
   attachment: File


- [ ] Send email using sendgrid to a configurable user email
- [ ] Handle errors
- [ ] Send attachments
- [ ] Send formatted html emails (can be vary basic using tags like div, b, pre etc)

2 - Endpoint: /mail/subscription

Description: This endpoint is used to store user subscription emails, the goal is to keep every email stored in a persistent storage, where it can be later retrieve for further usage. 

Required Payload: { email: string }


- [ ] Handles the case of duplicated entries
- [ ] Persist on local database

Additional Requirements: 

The apis has to work asynchronously (Non Blocking), follow RESTful conventions, clean code, follow Laravel standards, and lastly don’t use excuses like: “I didn’t do this because it’s was a simple project i didn’t felt it was necessary” we want see what you are capable of so do everything that’s under your knowledge. 

- A ZIP of the project (without the vendor folder)


设计原则 > 设计模式



你对PHP新版本的特性有关注吗?7.4 有哪些新特性你比较喜欢。

// 类型属性

// 箭头函数

// 数组扩展运算符

What‘s your favorite framework?Why?


Document, Community, Packages, Eloquent ORM(ActiveRecord)

What‘s the difference between left join and right join?

Can you explain what‘s Eager Loading?

//If we have 25 books, this loop would run 26 queries

$books = App\Book::all();

foreach ($books as $book) {
    echo $book->author->name;

//For this operation, only two queries will be executed
$books = App\Book::with('author')->get();

foreach ($books as $book) {
    echo $book->author->name;

 1,908 total views,  1 views today

Leave a comment

Your email address will not be published. Required fields are marked *