r/PHP 1d ago

Article ElephpantDB: a database in pure PHP

https://deployer.org/blog/elephpantdb
79 Upvotes

36 comments sorted by

24

u/KiwiBuntu 1d ago

Nicely done. May PHP never die.

36

u/matthewralston 1d ago

Excellent! This is exactly the missing piece that my enterprise banking platform serving 13 million high-wealth customers needed. I'm implementing it immediately. Should be able to have it in production by Friday afternoon. 👌

10

u/EGreg 1d ago

Beautiful. Then you can host it on my 100x faster pure-PHP server.

6

u/thunk_stuff 1d ago

I have WS_FTP all ready to go, ASCII mode engaged.

3

u/matthewralston 1d ago

Active or passive mode?

4

u/thunk_stuff 1d ago

Living on the edge... passive mode.

3

u/matthewralston 1d ago

Works for me, I can never remember how to work out the argument for the PORT command. 🤷‍♂️

15

u/sachingkk 1d ago

Wow! I love the way PHP getting used..

I want to see a day where PHP also have many projects around machine learning and data crunching like Python

15

u/FluffyDiscord 1d ago

I think you should target Doctrine. If you can support what sqlite can in doctrine, this has a potential for truly small apps.

5

u/Am094 1d ago

Haha this is pretty cool, cool name

4

u/flyingkiwi9 1d ago

This is fantastically readable.

6

u/eurosat7 1d ago edited 1d ago

If you want to go single file you might want to optimize for speed and size and footprint. Having a version stripped of its types might be feasible. Also reduce formatting by killing whitespace and shortening names. Maybe you could do some benchmarks?

Or you might even preload it into memory completely, but where would be the fun in that.

3

u/Takeoded 1d ago

Bugs me that PHP has no support for memory mapped file operations. (*file_get_contents actually use it but that's not what i mean, I mean I/O not just I)

Anyway how's the performance? Anyone done any SQLite benchmarks?

3

u/laramateGmbh 1d ago

But why?

1

u/Radiant-Somewhere-97 1d ago

Because with AI, the sky's the limit.

0

u/lostmedia42 1d ago

I think testing would be one big reason. Writing a small self-contained app would be another. This combined with the newer native/compiled PHP attempts could make for a powerful environment.

7

u/fripletister 1d ago

In-memory SQLite already serves that use case

2

u/lostmedia42 1d ago

Sure, but a PHP database is cool too.

5

u/fripletister 1d ago

Not saying it isn't. What it isn't is practical or particularly needed.

2

u/ratbastid 1d ago

It's clever, I'll give it that.

Will I use it? No. No I will not.

2

u/muglug 1d ago

I think testing would be one big reason

Already exists here: https://github.com/vimeo/php-mysql-engine

1

u/lostmedia42 1d ago

Not only is this a cool project, I love your hand built testing framework. It looks as simple as it should be, and nothing more. Congrats on the launch!

1

u/Zealousideal_Post994 13h ago

Why? What problem does it solve?

1

u/LordAmras 1d ago

Is there a reason for doing it in a single file ?

6

u/alexfarran 1d ago

To hide their numbers

-1

u/LordAmras 1d ago

What numbers ?

I could understand if it created all in a single huge godclass.

Less boilerplate, less abstraction, force you to keep the whole thing as simple and as fast as possible. With the drawback of going to be harder to upgrade an to mantain, but at least I could see the idea.

But one file with a cleanly separated class structure is just a weird questionable decision.

2

u/fripletister 1d ago

You're taking this project way more seriously than its own author does

1

u/inducido 1d ago

"pant" : seriously? 😂

0

u/[deleted] 1d ago

[deleted]

3

u/Elfet 1d ago

elePHPantDB

1

u/lam_42 1d ago

Read carefully and weep

1

u/obstreperous_troll 1d ago

To say nothing of Postgres having the elephant mascot long before PHP. Then again this thing even has a VACUUM command, so ... ¯\(ツ)

1

u/halfercode 1d ago

Yes. The trunk does the vacuuming.

-3

u/hm2k 1d ago

Why?