Image copyright Matt Johnson, WSB-TV Image caption Sonya King: "It was definitely about to be a murder and it was going to be me"

It's never been easier to get a takeaway - dozens of apps now let us order hot meals to our front door within minutes. But they've also flooded our streets with thousands of delivery drivers, who face intimidation, serious injury and even death to bring us our food.

Sonya King was hoping for a bumper payday when she logged into her DoorDash driver account in downtown Atlanta, Georgia, on 5 May last year, as public holidays like Cinco de Mayo were usually some of her busiest shifts.

But she only managed one order that day, and it almost cost her life.

As Sonya, a Muslim, left her first delivery, her customer, Rick Painter, attacked her from behind and tried to strangle her with her hair and niqab. The 31-year-old mother of four eventually managed to escape when she found her car keys and used them to stab Painter repeatedly in the face and head.

Image copyright Getty Images Image caption In Atlanta, public holidays can mean more orders and bigger payouts for drivers

"I was just rolling around and trying to pry off certain fingers, but he would not let my hair go. I stuck my finger in his eye, he would not let my hair go.

"It was definitely about to be a murder and it was going to be me."

"I didn't want to stab anybody, but I had to do it because I kept seeing my kids flashing before my eyes, and I kept seeing my husband, and thinking, 'I gotta get out of this house so I can go home to my family'.

Painter, 54, was given a two-year prison sentence for false imprisonment and misdemeanour battery.

Image copyright Matt Johnson, WSB-TV Image caption "I don't trust people, I expect the worst to happen" as a result of the attack, says Sonya

Sonya escaped with cuts and bruises, but says she still feels the emotional consequences of the attack. "I have become very distant with a lot of people that I love now. I don't trust people. I expect the worst to happen."

She's one of a small but significant number of food delivery drivers around the world who've been attacked or injured on the job.

The scale of the problem is hard to assess because police forces don't yet gather statistics on it, and the companies themselves don't publish any.

But reports of attacks on food delivery drivers can be found all over the world - from Sydney to New York.

In London it's not customers that drivers are worried about, but criminal gangs targeting them for their transport - typically motorbikes or mopeds.

Violence or the threat of it is an almost daily occurrence, say some.

Image caption "A group of robbers, around eight to 10 people, came out of the darkness," says Shajidur Rahman

"The delivery driver is the most vulnerable person on the street," says UberEats driver Shajidur Rahman. In August the 31-year-old was attacked in east London as he returned home about 9pm.

"A group of robbers, around eight to 10 people, came out of the darkness. One of them did a flying kick and knocked me off my bike. Then they started hitting me."

The gang stole his moped and mobile phone, fracturing his shoulder and foot.

Moped and motorbike-related crime in London has become such a problem that the Metropolitan Police has set up a task force called Operation Venice to tackle it.

The Met says it doesn't have figures on how many of these incidents involve delivery drivers - but Mr Rahman and his fellow drivers have had enough. He says they are now alerting each other to trouble via Whatsapp and even grouping together to chase and confront attackers.

The Met did not respond to BBC requests for a comment, but says in the last year the number of recorded moped, scooter or motorbike crimes has fallen by half to just under 9,000 - which is still around one every hour.

Drivers say the companies could do more to protect and help them. Because Mr Rahman is classed as a self-employed contractor rather than an employee, he's not eligible for any sickness cover - although he was told UberEats' insurers would pay out one month's income protection.

Image copyright Getty Images Image caption UberEats says it "works hard to improve the safety of couriers"

"My family was completely dependent on me. Now I have become dependent on them - I don't know how I will cover all of this."

He is also critical of UberEats' software as it doesn't let drivers see where they are delivering until they accept an order, making it hard to avoid known gang hotspots.

"It's only after we pick up the food that we see the drop-off address. Then even if we wanted to cancel the job we can't because they could suspend our account."

UberEats didn't respond to these specific concerns, but says it "works hard to improve the safety of couriers who use the app".

The firm says couriers can select up to five friends or family members as "trusted contacts" and share their locations as they deliver. An emergency assistance button allows drivers to call for help directly from the app in emergencies, and their real-time GPS location is tracked.

Attacks may make the headlines, but it is traffic accidents that are perhaps the biggest risk, as driver try to make as many deliveries as possible in the shortest time to boost their earnings.

Image copyright Getty Images Image caption Another accident: A Glovo delivery rider after a collision with a car in Buenos Aires

Earlier this year a judge banned food delivery apps from operating in Argentina's capital, Buenos Aires, because of concerns some firms weren't satisfying labour and transport laws. The companies deny this and have appealed against the ruling.

Judge Roberto Gallardo's decision was partly prompted by 63-year-old Ernesto Floridia, who was hit by a car while delivering a pizza ordered through Glovo - one of Argentina's biggest takeaway platforms.

After the crash Ernesto messaged the company to say he'd been injured and couldn't move, but in response one of Glovo's support staff asked him for a picture of the food so it could cancel the order.

Glovo says it takes this case very seriously and has apologised, saying "we agreed at the time it was wrong and it must have been very upsetting for Ernesto to receive".

A spokesperson adds that the customer service team member has been removed from the team and that Ernesto has made a full recovery and still works with Glovo.

Back in Georgia, Sonya King says DoorDash should do more to protect its 400,000 couriers, such as background checks to identify customers with criminal records - Rick Painter had been in and out of prison for other violent offences before she went to his door.

Image copyright Sonya King Image caption Sonya King says DoorDash should do more to protect its 400,000 couriers

She also complains that after the attack she wasn't able to speak to anyone from the San Francisco company - she could only email them - and that it was three days before anyone actually called to check on her.

"I almost died! It was just disgusting."

DoorDash says it "sincerely regrets" the handling of Sonya's case. "We take the safety of our community extremely seriously and do not tolerate any form of harassment or inappropriate behaviour."

The firm says it has now introduced a free occupational accident insurance policy for all its US drivers.